By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,631 Members | 892 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,631 IT Pros & Developers. It's quick & easy.

Transforming FixML using XSLT to a text file -strange output

P: 1
I have added:

<br><xsl:value-of select="Line" /></br>

to my XSLT stylesheet to get a line per repeating block. When I view the output as XML it looks perfect - one line per block. However when I output the file to a text file, all the data is wrapping and at the end of each block I am getting the text part of the header included but not all of it. The text that appears is:

<br xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:user="urn:additional-functions" />

I have tried different variations of the <br> command above, but the text above keeps coming out.

So for example, I have three repeating blocks and each is ending with pipe, but the output comes out as follows
200809021005554|NEWM|BROKER|FUND52|09022008|200802 13|S|BRL|1000000|AUD|1564891|1.564891|
<br xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:user="urn:additional-functions" />200809021005554|NEWM|BROKER|FUND54|09022008|20080 213|S|BRL|2000000|AUD|3129782|1.564891|
<br xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:user="urn:additional-functions" />


the full XSLT is as follows. Apolgies in advance if it is really messy, I'm not a programmer (and at this rate probably never will be!). Thank you in advance for your help.

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:user="urn:additional-functions" xmlns:a="http://www.fixprotocol.org/FIXML-4-4" exclude-result-prefixes="a">
<xsl:output method="text" omit-xml-declaration="yes" indent="yes"/>
<xsl:variable name="tradecount">0</xsl:variable>

<xsl:template match="/">
<xsl:apply-templates select="/a:FIXML/a:AllocInstrctn" />
</xsl:template>

<xsl:template match="/a:FIXML/a:AllocInstrctn">


<xsl:for-each select="a:Alloc">


<!--unique reference made up of trade date and trade id-->
<xsl:value-of select="concat(substring(/a:FIXML/a:AllocInstrctn/@TrdDt,1,4),substring(/a:FIXML/a:AllocInstrctn/@TrdDt,9,2),substring(/a:FIXML/a:AllocInstrctn/@TrdDt,6,2))"/>
<xsl:value-of select = "/a:FIXML/a:AllocInstrctn/@ID2"/><!--new or cancel-->|NEWM|<xsl:value-of select="/a:FIXML/a:AllocInstrctn/a:Pty[@Src='B' and @R=1]/@ID"/>|<xsl:value-of select = "@Acct"/>|<xsl:value-of select="concat(substring(/a:FIXML/a:AllocInstrctn/@TrdDt,9,2),substring(/a:FIXML/a:AllocInstrctn/@TrdDt,6,2),substring(/a:FIXML/a:AllocInstrctn/@TrdDt,1,4))"/>|<xsl:choose>
<xsl:when test="@LinkTyp=1 and a:Instrmt/@ID='FORWARD'">
<xsl:value-of select="concat(substring(/a:FIXML/a:AllocInstrctn/@SettlDt2,1,4),substring(/a:FIXML/a:AllocInstrctn/@SettlDt2,6,2),substring(/a:FIXML/a:AllocInstrctn/@SettlDt2,9,2))"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="concat(substring(/a:FIXML/a:AllocInstrctn/@SettlDt,1,4),substring(/a:FIXML/a:AllocInstrctn/@SettlDt,6,2),substring(/a:FIXML/a:AllocInstrctn/@SettlDt,9,2))"/>
</xsl:otherwise>
</xsl:choose>|<xsl:choose>
<xsl:when test="@Side=1">
<xsl:text>B</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>S</xsl:text>
</xsl:otherwise>
</xsl:choose>|<xsl:choose>
<xsl:when test="@Ccy=substring(/a:FIXML/a:Instrmt/@Sym,1,3 and @Side=1)">
<xsl:value-of select="substring(/a:FIXML/a:AllocInstrctn/a:Instrmt/@Sym,5,3)"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="substring(/a:FIXML/a:AllocInstrctn/a:Instrmt/@Sym,1,3)"/>
</xsl:otherwise>
</xsl:choose>|<xsl:choose>
<xsl:when test="@Ccy='JPY'">
<xsl:value-of select="format-number(number(@Qty),'####')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="format-number(number(@Qty),'####.##')"/>
</xsl:otherwise>
</xsl:choose>|<xsl:choose>
<xsl:when test="@Ccy=substring(/a:FIXML/a:AllocInstrctn/a:Instrmt/@Sym,1,3 and @Side=1)">
<xsl:value-of select="substring(/a:FIXML/a:AllocInstrctn/a:Instrmt/@Sym,1,3)"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="substring(/a:FIXML/a:AllocInstrctn/a:Instrmt/@Sym,5,3)"/>
</xsl:otherwise>
</xsl:choose>|<xsl:choose>
<xsl:when test="substring(a:Instrmt/@Sym,5,3)='JPY'">
<xsl:value-of select="format-number(number(@NetMny),'####')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="format-number(number(@NetMny),'####.##')"/>
</xsl:otherwise>
</xsl:choose>|<xsl:choose>
<xsl:when test="@LinkTyp=1 and a:Instrmt/@ID='FORWARD'">
<xsl:value-of select = "/a:FIXML/a:AllocInstrctn/@AvgPx2"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select = "/a:FIXML/a:AllocInstrctn/@AvgPx"/>
</xsl:otherwise>
</xsl:choose>|<xsl:value-of select="a:Stip[@Typ='TEXT']/@Val"/>
<xsl:value-of select="a:Pty[@Src='D' and @R=11]/@ID"/>

<xsl:text> </xsl:text>

<br/><xsl:value-of select="Line" /></br>
</xsl:for-each>


</xsl:template>
</xsl:stylesheet>
Feb 9 '08 #1
Share this Question
Share on Google+
1 Reply


jkmyoung
Expert 100+
P: 2,057
Change the exclude-result-prefixes attribute to exclude these namespaces.
exclude-result-prefixes="a msxsl user"
Feb 11 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.