Hello,

If I run the compact simple example provided at the end, I get this result.

<test>
<a>Hello</a>
<b/>
<c>World</c>
</test>

For 'a' and 'c' it works as expected, but I do not understand the
behaviour of 'b'.

For the 'a' case, the select computes the validity of t1/t2[1] and as
it is not satisfied, it looks for the next one, t1/t2[2].

Instead, for the 'b' case, the select only computes the validity of
t1/t2[1], and although it is not satisfied, it does not continue with
the next one.

Why this?
because of using a function (normalize-space)?

Is this a bug (I am using org.apache.xalan.xslt.Process)
or a property of the XSLT language?

If it is a property, how to achieve my expected behaviour?

-----
I need to use the normalize-space function so that the stylesheet
works in cases like this:
<test>
  <t1>
    <t2>Hello</t2>
    <t2>
World</t2>
  </t1>
</test>
-----

=========
xml file:
<test>
  <t1>
    <t2>Hello</t2>
    <t2>World</t2>
  </t1>
</test>

stylesheet:
<xsl:template match="/test">
<test>
  <a><xsl:value-of select="t1[t2='World']/t2"/></a>
  <b><xsl:value-of select="t1[normalize-space(t2)='World']/t2"/></b>
  <c><xsl:value-of select="t1/t2[.='World']"/></c>
</test>
</xsl:template>
<?xml version="1.0" encoding="utf-8"?>

<test>
  <t1>
    <t2>Hello</t2>
    <t2>World</t2>
  </t1>
</test>








Attachment: a.xsl
Description: application/beep

Reply via email to