Subject: RE: Can I print well-formed XML/HTML in text output mode
From: Americo Albuquerque <melinor@xxxxxxxx>
Date: Sun, 26 Oct 2003 19:37:51 -0000
|
Hi
> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of
> Nathaniel Stoddard
> Sent: Sunday, October 26, 2003 7:17 PM
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: RE: 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><</xsl:text>
<xsl:value-of select="name()"/>
<xsl:apply-templates select="@*"/>
<xsl:text>/> </xsl:text>
</xsl:template>
<xsl:template match="*[node()]">
<xsl:call-template name="indent"/>
<xsl:text><</xsl:text>
<xsl:value-of select="name()"/>
<xsl:apply-templates select="@*"/>
<xsl:text>>$#10;</xsl:text>
<xsl:apply-templates/>
<xsl:call-template name="indent"/>
<xsl:text></</xsl:text>
<xsl:value-of select="name()"/>
<xsl:text>> </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
|