Groups | Blog | Home
all groups > dotnet xml > november 2006 >

dotnet xml : Confused with XSLT



David
11/30/2006 4:32:22 PM
I am new to XSLT and am confused by this example. If the {href} is
part of the img tag, then the value will appear, however, when I
specify "<span>{href}</span>", then the value of <href> will not
appear. Is there a reason that one way works and the other does not?
Or do I need to use some escape code to force printing?


Thanks

P.S. I know that a way to print the item is "<xsl:value-of
select="href"/>"


==========================
<xsl:variable name="image-dir">/images</xsl:variable>

<xsl:template match="photograph">
<img src="{$image-dir}/{href}" width="{size/@width}"/>
</xsl:template>

With this source

<photograph>
<href>headquarters.jpg</href>
<size width="300"/>
</photograph>

the result would be

John Saunders
12/2/2006 2:15:30 PM
[quoted text, click to view]

The stuff in curley brackets {} are "attribute value templates". They only
work in the specification of the value of an attribute. They cannot be used
to specify the value of an element.

John

AddThis Social Bookmark Button