[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Problem with xsl:if

Subject: RE: Problem with xsl:if
From: "Kenny Akridge" <kenny@xxxxxxxxxxxxxxxxx>
Date: Wed, 21 Apr 2004 12:09:30 -0400
kenny gerald
You could do if not() or xsl:choose.  But you may want to check your logic.

-----Original Message-----
From: Gerald Fingerlos [mailto:gerald@xxxxxxxxxxxx] 
Sent: Wednesday, April 21, 2004 12:05 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject:  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="*[@attr-name='jkuPeHabd']">
		<xsl:variable name="slart"
select="//*[@attr-name='jkuPeBeschSAP22SLART']//value"/>
		<xsl:variable name="slabs"
select="//*[@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

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.