|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Converting XML to Fixed Length Text Data
David, I tried using the template you showed me, but I got output such as
aChild anotherChild yetAnotherChild instead of the positions specified in Problem below 1) Can you provide full details for at least one element and one attribute? 2) What happens if one of the elements is optional and not passed on the source xml file? Wouldn't this throw off the position of the fields which follow? ( e.g. if child2 was not on the source xml file, what impact would this have on the output? ) <<<< Solution >>>>>>>>>> Solution: ( David's response ) <xsl:variable name="pad1" select="' '"/> <xsl:template match="child1"> <xsl:value-of select="."/> <xsl:value-of select="substring($child1,string-length(.))"/> </xsl:template> and similarly the other children. (This doesn't do any error checking for over-run, although that could be added.) David <<<<<Problem >>>>>>>>>>>>> Problem: Ladies and Gents, I need some guidance . I searched the archives and found some info but it was not sufficient. Basically I want to convert an xml file to a fixed length data file. The following is a sample of what I am trying to do Position of data for output file: field: child1 start 1 length 7 field: att1 start 12 length 5 field: child2 start 27 length 12 field: child3 start 39 length 15 field: att2 start 56 length 3 Input: <parent att1="foo"> <child1>aChild</child1> <child2>anotherChild</child2> <child3 att2="bar">yetAnotherChild</child3> </parent> Output: aChild foo anotherChildyetAnotherChild bar Thanking you in advance for the info Garvin Franco garvin_franco@xxxxxxxxxxx </xsl:text>) or value-ofFrom: David Carlisle <davidc@xxxxxxxxx> Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: Re: Converting XML to Fixed Length Text Data Date: Mon, 25 Mar 2002 21:28:28 GMT (<xsl:value-of select="''"/>)
_________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp. XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








