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
Show tree view Topic
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext 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

 
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
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.