This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: testing an attribute value and node value
- To: xsl-list at mulberrytech dot com
- Subject: Re: testing an attribute value and node value
- From: Warren Hedley <w dot hedley at auckland dot ac dot nz>
- Date: Tue, 19 Sep 2000 11:53:45 +1200
- CC: Russ Holmes <rholmes at elite dot com>
- Organization: The Department of Engineering Science, The University of Auckland
- References: <F3049VPRfLC7A9BzqRE00010511@hotmail.com> <008301c021bd$59ad5080$0600a8c0@nz2000>
- Reply-To: xsl-list at mulberrytech dot com
Hi Russ,
It appears from your stylesheet namespace that you're using an old version of IE5,
so the following may not work. (Actually, I haven't had time to test it so it may
not work at all.)
Russ Holmes wrote:
>
> I want to generate HTML for each node 'F' dependent on the value of the 'n'
> attribute and the value of the current node.
Do you only want to produce output for certain values of @n? If not, then
you should be fine with this.
<xsl:template match="F">
<DIV>
<xsl:if test=". = '1'">
<b>
<xsl:value-of select="concat(@n, ' Works')" />
</b>
</xsl:if>
</DIV>
</xsl:template>
Note that your test expression
> <xsl:when test="@n[.='100' and //F[.='1']]">
is not selecting the parent F element of the @n attribute as you may be
thinking. "//F" selects all F elements in the document. If you want to
test on specific values of @n as well as the contents of F being "1", then
try
<xsl:template match="F">
<DIV>
<xsl:if test=". = '1' and @n = '100'"> ...
> My other thought was to alter the XMl slightly so that it had the '1' value
> as an attribute..
Hopefully, it shouldn't be necessary.
Hope this helps.
--
Warren Hedley
Department of Engineering Science
Auckland University
New Zealand
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list