This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: xsl-list@lists.mulberrytech.com



Hi Amanda..
The unicode symbol for tab is #x9;
so u have to use this for producing a tab in the output..
an example would be..
if your xml file is
<students>
<student>
<name>A.J.Nonameson</name>
<age>23</age>
<college>Best-college</college>
</student>
<student>
<name>P.J.Somenameson</name>
<age>23</age>
<college>Worst-college</college>
</student>
</students>
-----
and xsl would be
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
<xsl:output method="text" omit-xml-declaration="yes"/>
<xsl:template match="student">
<xsl:value-of select="name"/><xsl:text>&#x9;</xsl:text>
<xsl:value-of select="age"/><xsl:text>&#x9;</xsl:text>
<xsl:value-of select="college"/>
<xsl:text>&#xa;</xsl:text>
</xsl:template>
</xsl:stylesheet>
---
to produce a result..
A.J.Nonameson 23 Best-college
P.J.Somenameson 23 Worst-college
-----
The important things when dealing with text output is..
1. <xsl:output> declaration...
you should declare the method to be text and make sure you omit-xml- declaration
** <xsl:output method="text" omit-xml-declaration="yes"/> **
2. Unicode Symbols for characters like tab,newline,carraige return, space etc..

tab ---> #x9
space ---->#x20
newline --->#xa
carraige return-->#xD
check up the above code to see how these are used ( u should use them with <xsl:text></xsl:text> ..as in <xsl:text>&#x9;</xsl:text> for tab
and <xsl:text>&#xa;</xsl:text> for a newline..

Hope this helps
Vasu







>
> Hello, List,
> I have been asked to add a feature to our web application that will
> transform our XML into tab-delimited text data, displayed in a
> new window,
> so that the user can then save it for later use in that
> format.  Unfortunately, I am currently limited to what can be done with
> MSXML 2.5 (been told we have to support IE5 without any upgrades to the
> parser).
>
> Although I've done a lot of XML-to-XML and XML-to-HTML transformations,
> I've never done XML-to-text before.  Can anyone direct me on how I would
> (a) cause tabs to appear in the output, and (b) cause linebreaks
> to appear
> in the output?

_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.com


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]