This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: How to embed xsl:value-of into html tag


Chris,

>When I use the AVT, it won't advance past my fisrt URL, but I use a value
>of select for what is displayed on the screen and that advances fine:

Presumably this is inside a template matching 'patn' or a xsl:for-each
iterating over them, e.g.:

<xsl:template match="patn">
 <A HREF="/details?pn={/hitlist/patn}"><xsl:value-of select="." /></A>
</xsl:template>

Look at the XPaths you're using.  To get the content of the link, you're
using a '.', which means 'get the string value of the current node'.  In
the AVT, you're using '/hitlist/patn', which means 'get the string value of
the 'patn' child(ren) of the 'hitlist' document element'.

/hitlist/patn will always give you all the 'patn' children of the 'hitlist'
element.  Node lists are converted into strings by taking the string value
of the first node in the node list - in this case the first 'patn' element
('1').  So you always get the same answer.

What you wanted was the string-value of the current 'patn' element -
exactly the same as you're using as the content of the link itself:

<xsl:template match="patn">
 <A HREF="/details?pn={.}"><xsl:value-of select="." /></A>
</xsl:template>

It's odd that you managed to get the right value for the xsl:value-of but
not the AVT.  AVTs work in exactly the same way as the 'select' expression
of xsl:value-of - if you want the same value, use the same XPath! ;)

I hope that clears things up,

Jeni

Jeni Tennison
http://www.jenitennison.com/



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]