This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
xsl:when question - am I doing something stupid or is this a limitation / processor bug?
- To: "'xsl-list at mulberrytech dot com'" <xsl-list at mulberrytech dot com>
- Subject: xsl:when question - am I doing something stupid or is this a limitation / processor bug?
- From: David Rigby <D dot A dot Rigby at btinternet dot com>
- Date: Thu, 6 Apr 2000 22:25:14 +0100
- Reply-To: xsl-list at mulberrytech dot com
Hi Folks
I'm fairly new to XSL, but I've been chucked in at the deep end. I've had
good results thus far using XSL to parse xml documents into a nicely
formatted report, but now I need to do something a bit cleverer and have
hit a problem...
I'm trying to write a stylesheet that switches on a runtime defined node to
produce HTML pages tailored to a particular product, defined at runtime. I
have the following template defined:
<xsl:template match="schematics"/>
<xsl:variable name="model" select="modelnumber"/>
<xsl:variable name="applicableModel"
select="documentation\currentModel"/>
<xsl:choose>
<xsl:when test="$model=$applicableModel"/>
<xsl:apply-templates select="link"/>
</xsl:when>
</xsl:choose>
</xsl:template>
(please excuse any typos in the listing...hopefully there aren't any)
If I print out the values of the model variable in the document, they are
as expected: namely 8800 in one case and 8801 in another. The currentModel
node is unique in the tree and is inserted at runtime. In this test case
it is 8800 and again is reported correctly if printed in the document. The
problem is that the test inside the xsl:when never succeeds. I tried all
manner of combinations of @ and $ tokens in desperation and useing
test="@model=@applicableModel" succeeds in all cases (presumably because
the value of applicableModel is being assigned to model within the test
itself..?) but nothing else yields any results, even when we're testing
model = 8800 against applicableModel = 8800.
I've looked all around for examples of using two variables in an XSL test
but can't seem to find any examples: the RHS always seems to include a
constant. The XSL specification seems to suggest that it ought to be valid
to test one variable against another, so am I doing something wrong or is
it a fault in the stylesheet processor? I THINK we're using the lotus
processor, although I don't recall off the top of my head since I'm now at
home :).
Any pointers would be greatly appreciated.
Thanks
David
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list