xml editor

Supported platforms

Compatible with Windows7 & Mac OS X Snow Leopard

Ready for data server software
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Converting XML to Fixed Length Text Data


Subject: Re: [xsl] Converting XML to Fixed Length Text Data
From: David Carlisle <davidc@xxxxxxxxx>
Date: Mon, 25 Mar 2002 21:28:28 GMT


  David thanks for the response, but I am not quite clear on the solution.
  1) How does the attribute "att1" vs the element "child1" know where to 
  position themselves on the output file? Shouldn't positional info be 
  declared somewhere?
it is "declared" by the length of the string variable declared for each
field. If $child2 starts off as a string of 20 spaces and 
you do
<xsl:value-of select="."/>
<xsl:value-of select="substring($child2,string-length(.))"/>
in the template for child2, then you will get the character data
of the element followed by enough spaces to pad the total to 20
characters (as long as the element had less than 20 characters)


   2) What about the element <xsl:text>, is this not required?
xsl:text is in favt never required, but here you don't need it as you
are not adding any literal text, only some spaces, which you can enter
with xsl:value-of.

So apart from the template I showed, you just need the settings of the
original strings to give the widths of each field, plus the template for
teh parent element needs to give a line break after each row, which you
can do with xsl:text (<xsl:text>&#10;</xsl:text>) or value-of
(<xsl:value-of select="'&#10;'"/>)

David

_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service. For further
information visit http://www.star.net.uk/stats.asp or alternatively call
Star Internet for details on the Virus Scanning Service.

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



Current Thread
XML Editor | XML Author | WYSIWYG Editors | Schema Editor | XSD Documentation | XSL/XSLT Editor | XQuery | XML Databases | SVN Client
© 2002-2011 SyncRO Soft Ltd. All rights reserved. | Sitemap | Privacy Policy | This website was created & generated with <oXygen/>®XML Editor