|
Subject: [xsl] Inconsistent values from <xsl:variable/> From: Adam Worrall <adam-xsllist@xxxxxxxxxx> Date: 15 Jun 2005 16:30:44 -0400 |
The use of an <xsl:if/> seem to result in different values being assigned:
<xsl:variable name="RTF_GOOD">
<xsl:value-of select="//out-form:Subform[@idType = 'RuleContent']"/>
</xsl:variable>
<xsl:variable name="RTF_BAD">
<xsl:if test="2 > 1">
<xsl:value-of select="//out-form:Subform[@idType = 'RuleContent']"/>
</xsl:if>
</xsl:variable>
Both have the same select="" expression; it's only the presence of the
<xsl:if/> that changes things.
$RTF_GOOD appears to contain the RTF that I expect;
$RTF_BAD appears to be a string containing the flattened text() from
within the RTF I expect.
Any ideas why they differ ? Is this a bug in Xalan ? A bug in my
understanding of XSL is far more likely :>
--- Details ---
The above is a trivial example; I know about <xsl:variable select="..."/>,
but I need to do some conditional logic to determine exactly which
nodeset to place into my variable.)
(It may also be worth pointing out that I'm repeatedly using XPath on
node-sets, along the lines of:
<xsl:variable "foo" select="//elem1"/>
<xsl:variable "bar" select="$foo//elem2"/>
<xsl:variable "quux" select="$bar/[@attr = 'thing']"/>
in case that explains anything ...)
I'm examining the contents using this:
<xsl:message>GOOD
<xsl:call-template name="dumpContext">
<xsl:with-param name="myNodeSet" select="xalan:nodeset($RTF_GOOD)"/>
</xsl:call-template>
</xsl:message>
<xsl:message>BAD
<xsl:call-template name="dumpContext">
<xsl:with-param name="myNodeSet" select="xalan:nodeset($RTF_BAD)"/>
</xsl:call-template>
</xsl:message>
<xsl:template name="dumpContext">
<xsl:param name="myNodeSet"/>
<xsl:for-each select="$myNodeSet">
<xsl:value-of select="local-name()"/>
<xsl:text>[</xsl:text>
<xsl:for-each select="ancestor-or-self::*">
<xsl:text>/</xsl:text><xsl:value-of select="local-name()"/>
</xsl:for-each>
<xsl:text>]</xsl:text>
<xsl:text>"</xsl:text>
<xsl:value-of select="text()"/>
<xsl:text>"</xsl:text>
</xsl:for-each>
</xsl:template>
And seeing output like this:
Validation ERROR: GOOD Subform[/QueryResult/FormSet/Form/Thing/Subform]""]
Validation ERROR: BAD []"aaaaacoy3y0co110yy2005-01-012005-01-012005-01-03"]
Many (many !) thanks,
- Adam
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] xml:lang, Mike Ferrando | Thread | Re: [xsl] Inconsistent values from , David Carlisle |
| Re: [xsl] How to select either Elem, chris | Date | [xsl] Opening a document on a serve, JBryant |
| Month |