473,385 Members | 1,817 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Transforming FixML using XSLT to a text file -strange output

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
1 3426
jkmyoung
2,057 Expert 2GB
Change the exclude-result-prefixes attribute to exclude these namespaces.
exclude-result-prefixes="a msxsl user"
Feb 11 '08 #2

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

Similar topics

1
by: Xamalaek | last post by:
Hello, Is it possible to transform an XML document to a binary format using XSL? Can one use XSL-FO to do this? Regards, X
5
by: Jody Greening | last post by:
Transforming with XSLT, Grouping elements until difference found. I am seeking some help with the following problem, I am fairly new at XSLT transformations, and my problem may lie in looking at...
2
by: awilliam | last post by:
I'm using the BIE workflow engine and after querying an LDAP DSA I need to transform the XML response, which looks like - <?xml version="1.0" encoding="UTF-8" ?> <batchResponse...
4
by: Showjumper | last post by:
I am using the NITF DTD for my xml files and i need to use 2 xsl files to do the transform: one for the <body.head> and the second for the <body.content>. I've got this so far for transforming...
4
by: Cathie | last post by:
Hi All, I am trying to get my style sheet to work. It works fine in IE but I can't get it to work in .net. Below is the function I use for transforming, where advancedOptionsFile is the path...
4
by: John Bowman | last post by:
Hi, I'm not certain this is the best place to post this, but here it goes. I'm trying to get spaces to work correctly when using the WebBrowser control. Basically, I've got a valid XML...
0
by: Scott | last post by:
The following blog gives a neat example of how to transform directly into a node: http://blogs.msdn.com/xmlteam/ However, the code doesn't seem to work as it is presented in the blog. I have...
1
by: Krista Lemieux | last post by:
Hello, I am trying to transform XML with XSL to a string in .NET. Currently I am using XSLTransform class, but all the Transform() methods write to a file. How can I Transform it straight to a...
1
by: MaggotChild | last post by:
Hi, I'm trying to transform the values entered into a form: HTML: <div id="container"> <div id="bs"> <input id="name" type="text"/> <p>PPPPP</p> <a href="#" onclick="return transform()">Do...
1
by: scmorgan | last post by:
Hi All, I am trying to come up with a solution for transforming a complex type ie xml ... <document> <label> This is a <highlight> string</highlight> </label>
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.