I would start by outputting the variable you are creating with xsl:copy to see
what you are getting.
from the xsl you provided I would guess that it's always empty, considering
that there are no 'jkuPeBeschSAP22SLART' attr-name attributes....
You are also using // which is short for /descendant-or-self::node()/, which
starts its search from the beginning of the document, and would return all
nodes in the document that matched your criteria. Try something like:
<xsl:variable name="slabs" select="../add-attr[(_at_)attr-name='jkuSLABS']"/>
Josh
-----Original Message-----
From: Gerald Fingerlos [mailto:gerald(_at_)fingerlos(_dot_)at]
Sent: Wednesday, April 21, 2004 9:05 AM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] Problem with xsl:if
I have the following XML Document:
<?xml version="1.0" encoding="UTF-8"?>
<input>
<add class-name="User">
<add-attr attr-name="jkuSLABS">
<value>90</value>
</add-attr>
<add-attr attr-name="jkuSLART">
<value>50</value>
</add-attr>
<add-attr attr-name="jkuPeHabd">
<value type="string">7777-33-11</value>
</add-attr>
</add>
</input>
What Id like to to is the get an output document which should contain
the
<add-attr attr-name="jkuPeHabd">
<value type="string">7777-33-11</value>
</add-attr>
only, if the jkuSLABS=90 AND jkuSLART=50. Otherwise the 3 lines should
be omitted.
I thought of the following, but I think I am misunderstanding
something:
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="*[(_at_)attr-name='jkuPeHabd']">
<xsl:variable name="slart"
select="//*[(_at_)attr-name='jkuPeBeschSAP22SLART']//value"/>
<xsl:variable name="slabs"
select="//*[(_at_)attr-name='jkuPeBeschSAP22SLABS']//value"/>
<xsl:if test="($slart!='50') or ($slabs!='90')">
</xsl:if>
</xsl:template>
As far as I can see the if never gets true, but still if it would be
true, I would need some "else" operation. Maybe you can give me a hint
how to solve this.
Thank you in advance,
Gerald
--+------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--+--