[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Problem with xsl:if


Subject: Re: [xsl] Problem with xsl:if
From: David Carlisle <davidc@xxxxxxxxx>
Date: Wed, 21 Apr 2004 17:17:02 +0100

<xsl:template match="*[@attr-name='jkuPeHabd']">

This will match your

         <add-attr attr-name="jkuPeHabd">
            <value type="string">7777-33-11</value>
         </add-attr>

but then you do

<xsl:variable name="slart"
select="//*[@attr-name='jkuPeBeschSAP22SLART']//value"/>

which ignores the element you are on. and searches the entire document
for an element with attr-name='jkuPeBeschSAP22SLART' I suspect that you
don't want to search the entire document, just the siblings of that the
add-attr that you are on? and in the example you posted there are no
attributes with values 'jkuPeBeschSAP22SLART' so this vriable will be an
empty node set and test will be false (beware using != with node set
valuedvariables by the way, the test is always true unless the set is
non empty and all values are equal)

I suspect that you want your identity template plus

	<xsl:template match="*[@attr-name='jkuPeHabd']
       [not(../*[@attr-name='jkuSLABS']/value=90 and ../*[@attr-name='jkuSLART]/value=50)]"/>

which will stop the 'jkuPeHabd' elements being copied unless their
siblings have the specified values.

David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________


Current Thread