OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   RE: [xml-dev] Newbie --- XSLT Transformations

[ Lists Home | Date Index | Thread Index ]

Hello Ira,

> Everything seems to work fine when there I have a <img_large> tag
> in my xml
> data. But when an article doesnt have an <img_large> then my
> stylesheet still
> attempts to create the html <img> tag. So, is there a way i can say "If
> image_large tag exist then apply the transformation if not then dont"


<xsl:if test="image_large">

do some processing

</xsl:if>

will do the trick, the default test is if its true or false....of course you
must have your path correct ( so if the current node is not image_large...u
have to adjust the path )

>
> Here is what i have so far for creating an img tag under my xslt
> stylesheet.
> This is done while looping through each article element
>
> <img>
>
>    <xsl:attribute name="src"><xsl:value-of select="//@src"
> /><xsl:value-of
> select="img_large" /></xsl:attribute>
>    <xsl:attribute name="width"><xsl:value-of
> select="//@width" /></xsl:attribute>
>    <xsl:attribute name="height"><xsl:value-of
> select="//@height" /></xsl:attribute>
>    <xsl:attribute name="align">right</xsl:attribute>
>
> </img>
>


hehe, use shorthand with curly brackets and literally output the align
attribute
like so

<img src="{img_large}" width="{@width}" height="{@height}" align="right"/>

much more readable, no ?



subscribe to xslt list go to www.mulberrytech.com

and read up xslt FAQ at www.dpawson.co.uk

and welcome to the world of xml/xslt

gl, jim fuller





 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS