xsl-list
[Top] [All Lists]

RE: Can I print well-formed XML/HTML in text output mode

2003-10-26 12:37:51
Hi

-----Original Message-----
From: owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com 
[mailto:owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com] On Behalf Of 
Nathaniel Stoddard
Sent: Sunday, October 26, 2003 7:17 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: RE: [xsl] Can I print well-formed XML/HTML in text 
output mode



Well, that didn't work for me.  Let me show you a quick XML 
and XSLT files so you can see what it is doing for me.

That's because you're using text method.

Try this:

<xsl:template match="*[not(node())]">
 <xsl:call-template name="indent"/>
 <xsl:text>&lt;</xsl:text>
 <xsl:value-of select="name()"/>
 <xsl:apply-templates select="@*"/>
 <xsl:text>/&gt;&#10;</xsl:text>
</xsl:template>

<xsl:template match="*[node()]">
 <xsl:call-template name="indent"/>
 <xsl:text>&lt;</xsl:text>
 <xsl:value-of select="name()"/>
 <xsl:apply-templates select="@*"/>
 <xsl:text>&gt;$#10;</xsl:text>
 <xsl:apply-templates/>
 <xsl:call-template name="indent"/>
 <xsl:text>&lt;/</xsl:text>
 <xsl:value-of select="name()"/>
 <xsl:text>&gt;&#10;</xsl:text>
</xsl:template>

<xsl:template match="@*">
 <xsl:text> </xsl:text>
 <xsl:value-of select="name()"/>
 <xsl:text>="</xsl:text>
 <xsl:value-of select="."/>
 <xsl:text>"</xsl:text>
</xsl:template>

<xsl:template name="indent">
 <xsl:for-each select="ancestor::*">
  <xsl:text> </xsl:text>
 </xsl:for-each>
</xsl:template>

Regards,
Americo Albuquerque



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



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