xsl-list
[Top] [All Lists]

RE: Text output: CR LF

2004-12-15 09:33:11
Hi Jan,

I tweaked your XSLT a bit. If you use

<xsl:template match="/XML/NODE1">
    <xsl:apply-templates select="NODE2" mode="abc"/>
</xsl:template>

<xsl:template match="NODE2" mode="abc">
  <xsl:value-of select="NODE3"/>&#xD;
</xsl:template> 

you get your wanted output. Leaving out '&#xD;' gives you your NOT-wanted
output. 

NOTE: This is tested in Xselerator 2.6 using MSXML 4.0. Can't tell for other
processors.

HTH,
<prs/>

-----Original Message-----
From: news(_at_)swisslab(_dot_)de [mailto:news(_at_)swisslab(_dot_)de] 
Sent: Wednesday, December 15, 2004 8:13 AM
To: 'xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com'
Subject: [xsl] Text output: CR LF

Hello List,

I m trying to transform an XML document into plain text using Saxon on a Win
XP system.
There for I defined a output element:
<xsl:output method="text" media-type="text/plain" encoding="iso-8859-1"/>

My problem is, that I dont get carriage returns and line feeds where I want
them to be (mostly I dont get them at all).

For example:
<XML>
        <NODE1>
                <NODE2>
                        <NODE3>a row</NODE3>
                </NODE2>
                <NODE2>
                        <NODE3>a row</NODE3>
                </NODE2>
        </NODE1>
</XML>

I have a template matching to 'NODE1'

  <xsl:template match="NODE1">
    <xsl:apply-templates select="//NODE2" mode="abc"/>
  </xsl:template>                        

applying over all 'NODE2' nodes. Within this node, I want 'NODE3' as a row. 
  
  <xsl:template match="NODE2" mode="abc">
        <xsl:value-of select="*//NODE3"/>&#xD;
  </xsl:template>

What I get is:
a rowarow

What I want is:
a row
a row

What are I m doing wrong? Can you help me?
Thanks, Jan

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>