XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Conferences Close Tree View
+ Stylus Studio Feature Requests (1192)
+ Stylus Studio Technical Forum (14621)
+ Website Feedback (249)
- XSLT Help and Discussion (7625)
-> + Use of before and after string (3) Sticky Topic
-> - How do I substitute element ty... (1)
-> + How does one add working days ... (4)
-> - Help, I have existing XLT and... (1)
-> + Need help on XSLT issue - (2)
-> + EDI to XML Conversion (7)
-> - XML To JSON Conversion using X... (1)
-> + Formatting Paragraphs to same ... (2)
-> - Grouping of records (1)
-> + Problems with xsd 1.1 (4)
-> + XML to HL7 mapping (3)
-> + XSLT 3 and Iterate (2)
-> + XSL-FO to PDF preview (3)
-> + java.lang.RuntimeException: Er... (2)
-> + Create Acroforms with Stylus X... (2)
-> + How to change XSLT parameter s... (3)
-> + how to change format of the da... (2)
-> + Search "Next 8 Results " doesn... (2)
-> - Support for Git (1)
-> + newbee (8)
-- [1-20] [21-40] [41-60] Next
+ XQuery Help and Discussion (2017)
+ Stylus Studio FAQs (159)
+ Stylus Studio Code Samples & Utilities (364)
+ Stylus Studio Announcements (113)
Topic  
Postnext
Hari KrishnaSubject: If Else Condition along with Loop
Author: Hari Krishna
Date: 05 Dec 2007 12:56 PM
Any Help is much appreciated.

E1EDL37 contains one of the field value as RFID_PALLET and RFID_CASE
When Pallet comes, i need to find the relative cases and write below to the pallet. This is working fine with the below logic. Case variable will contains those RFID_CASE numbers and search and write them below the pallet. If i have any number of pallets and correspondent cases, it is taking care of.

<xsl:for-each select="E1EDL37[VHILM='RFID_PALL']">
<xsl:copy-of select="." />
<xsl:for-each select="E1EDL44">
<xsl:variable name="Case">
<xsl:value-of select="EXIDV" />
</xsl:variable>
<xsl:copy-of select="../../E1EDL37[EXIDV=$Case]" />
</xsl:for-each>
</xsl:for-each>


But when it comes to only cases with out Pallet's, i am trying to implement the code here and having some troubles. I am new to XSLT, so any logical and syntax is much appreciated

What i am trying to here is
First Loop the E1EDl37 and see if there is any RFID_PALL exists, if yes set the variable value to YES. So that when i use xsl:when i should check for YES other wise write all the cases

I am having some syntax errors and i am not sure if the logic works fine. So can any of GURU can help me. I really appreciate any input here

<xsl:for-each select="E1EDL37[VHILM='RFID_PALL']">
<xsl:variable name="RFIDPALLET" select='YES'/>
</xsl:for-each>

<xsl:choose>
<xsl:when test='$RFIDPALLET="YES"'>
<xsl:for-each select="E1EDL37[VHILM='RFID_PALL']">
<xsl:copy-of select="." />
<xsl:for-each select="E1EDL44">
<xsl:variable name="Case">
<xsl:value-of select="EXIDV" />
</xsl:variable>
<xsl:copy-of select="../../E1EDL37[EXIDV=$Case]" />
</xsl:for-each>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
<xsl:copy-of select="../../E1EDL37" />
</xsl:otherwise>
</xsl:choose>

Posttop
(Deleted User) Subject: If Else Condition along with Loop
Author: (Deleted User)
Date: 06 Dec 2007 09:24 AM
Hi,
XSLT is not a procedural language, so declaring a variable in this way will not work; you should just use a <xsl:when test="count(E1EDL37[VHILM='RFID_PALL']) &gt; 0"> condition.

Hope this helps,
Alberto

   
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.