RE: [xsl] Extract First node

Subject: RE: [xsl] Extract First node
From: david_n_bertoni@xxxxxxxxxx
Date: Fri, 2 Sep 2005 02:13:50 -0400
> Hi,
> Couple of things, I am using stylesheet v="2.0" with Saxon-B8.5 instead
> of version="1.0" and Saxon8.4.

OK, that was an important detail that you left out.  This is why including 
complete _minimal_ stylesheet can save lots of confusion and bandwidth.

> I also tried to transform it with Xalan2.7.0 and get the desired output
> as is yours. But I have to use vesrion="2.0" for other stuff in my real
> xslt as this one is just an example. Can anyone tell me if this is a
> known issue with Saxon-B8.5

xsl:value-of works differently in XSLT 2.0 than it does in 1.0:

http://www.w3.org/TR/xslt20/#value-of

One option is to use backwards-compatible behavior:

http://www.w3.org/TR/xslt20/#dt-backwards-compatible-behavior

another is to ensure you only select one node:

<xsl:template match="/a">
  <xsl:value-of select="(b/c[@type='pdf'][1])[1]" />
</xsl:template>

Note that the following might be what you really want -- it's hard to tell 
from your prose description of the problem:

<xsl:template match="/a">
  <xsl:value-of select="(b/c[@type='pdf'])[1]" />
</xsl:template>

Dave

Current Thread