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
W MokSubject: Add Condition check in a multi-tag
Author: W Mok
Date: 16 Aug 2006 09:36 AM
Hello,

I have a problem to select a Higher @AllocPct in a multi-tag <Undly></Undly>. In the following case, I only need to pick up
SNV since the AllocPct is 80.

Here is my XML

<FIXML r="20030618" s="20040109" v="4.4" xr="FIA" xv="1" xmlns="http://www.fixprotocol.org/FIXML-4-4">
<Batch>
<SecDef BizDt="2006-04-24" RptID="23729" Ccy="USD"><Instrmt StrkValu="100" Mult="100" StrkMult="1" NTPosLmt="0" PosLmt="25000000" MinPxIncr="0.01" Sym="SNV" Desc="STAN" CFI="OXASPS" StrkCcy="USD" AsgnMeth="R" SettlOnOpenFlag="N"><Evnt EventTyp="5" Dt="1997-04-01"/><Pty ID="XCBO" R="22"><Sub ID="1997-04-01" Typ="27"/></Pty><Pty ID="XPHO" R="22"><Sub ID="1997-04-01" Typ="27"/></Pty><Pty ID="XPSE" R="22"><Sub ID="2004-07-08" Typ="27"/></Pty><Pty ID="OCC" R="21"/></Instrmt>
<Undly Sym="SNV" ID="87161C105" Src="1" Qty="100" SettlStat="1" AllocPct="80" CFI="EXXXXX" SettlTyp="4" SetMeth="CCC"></Undly>
<Undly Sym="HCV" ID="87161C105" Src="1" Qty="100" SettlStat="1" AllocPct="10" CFI="EXXXXX" SettlTyp="4" SetMeth="CCC"></Undly>
<Undly Sym="S" ID="87161C105" Src="1" Qty="100" SettlStat="1" AllocPct="10" CFI="EXXXXX" SettlTyp="4" SetMeth="CCC"></Undly>
</SecDef>
</Batch>
</FIXML>


My XSL
<?xml version="1.0" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:a="http://www.fixprotocol.org/FIXML-4-4">
<xsl:output method="text" />
<xsl:strip-space elements="*" />
<xsl:template match="text()" />
<xsl:template match="/a:FIXML/a:Batch/a:SecDef">
<xsl:for-each select="a:Instrmt">
<xsl:value-of select="concat(@NTPosLmt, '|', @PosLmt, '|', @Sym, '|', @Desc, '|', @CFI, '|', @StrkCcy, '|', @SettlOnOpenFlag)" />
<xsl:for-each select="a:Pty">
<xsl:value-of select="concat('|', @ID)" />
</xsl:for-each>
</xsl:for-each>
<xsl:for-each select="Undly">
<xsl:value-of select="concat('|', @Sym, '|', @Qty, '|', @AllocPct)" />
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>

Thanks in advance for any help
Wai

Postnext
Ivan PedruzziSubject: Add Condition check in a multi-tag
Author: Ivan Pedruzzi
Date: 16 Aug 2006 09:59 PM
Hi Wai,

Please use the following code to sort the elements "Undly" order by @AllocPct with descending order and pick the first one, the higher

<xsl:for-each select="a:Undly">
<xsl:sort select="@AllocPct" order="descending" data-type="number"/>
<xsl:if test="position() = 1">
<xsl:value-of select="concat('|', @Sym, '|', @Qty, '|', @AllocPct)"/>
</xsl:if>
</xsl:for-each>


Hope this helps
Ivan Pedruzzi
Stylus Studio Team

Posttop
W MokSubject: Add Condition check in a multi-tag
Author: W Mok
Date: 17 Aug 2006 12:33 PM
Ivan,

It helps. Thanks a lot.

Wai

   
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.