You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Darren Scott <ds...@bluecheese.co.uk> on 2000/05/19 17:29:01 UTC
XSL Passthrough
Hi,
Does anybody have an XSL sheet which will pass through the source tree
formatted in HTML - ie so you can view it in the browser.
I just thought it could be really useful for debugging XSP pages
Darren Scott
Production Director
bluecheese.co.uk
Re: XSL Passthrough
Posted by Ulrich Mayring <ul...@denic.de>.
Stefano Mazzocchi wrote:
>
> Darren Scott wrote:
> >
> > Hi,
> >
> > Does anybody have an XSL sheet which will pass through the source tree
> > formatted in HTML - ie so you can view it in the browser.
> >
> > I just thought it could be really useful for debugging XSP pages
>
> distributed in Cocoon you find the
>
> /samples/xsp/view-source.xml
>
> which is an XSP that pretty-prints your XML with color highlightning.
> Use as
>
> /sample/xsp/view-source.xml?filename=[your XML document]
>
> Hope it helps.
Yeah, but I think the original poster wants to see the XML generated by
an XSP page, not the original XML file. The easiest way to do that is
just uncomment the XSLT PIs and "view source" in the browser.
Ulrich
--
Ulrich Mayring
DENIC eG, Systementwicklung
Re: XSL Passthrough
Posted by Stefano Mazzocchi <st...@apache.org>.
Darren Scott wrote:
>
> Hi,
>
> Does anybody have an XSL sheet which will pass through the source tree
> formatted in HTML - ie so you can view it in the browser.
>
> I just thought it could be really useful for debugging XSP pages
distributed in Cocoon you find the
/samples/xsp/view-source.xml
which is an XSP that pretty-prints your XML with color highlightning.
Use as
/sample/xsp/view-source.xml?filename=[your XML document]
Hope it helps.
--
Stefano Mazzocchi One must still have chaos in oneself to be
able to give birth to a dancing star.
<st...@apache.org> Friedrich Nietzsche
--------------------------------------------------------------------
Missed us in Orlando? Make it up with ApacheCON Europe in London!
------------------------- http://ApacheCon.Com ---------------------
Re: XSL Passthrough
Posted by Ulrich Mayring <ul...@denic.de>.
dscott@bluecheese.co.uk wrote:
>
> Hi,
>
> Does anybody have an XSL sheet which will pass through the source tree
> formatted in HTML - ie so you can view it in the browser.
>
> I just thought it could be really useful for debugging XSP pages
Check out the XSP samples, there's a view_source thingy with fancy
syntax-highlighting even.
Ulrich
--
Ulrich Mayring
DENIC eG, Systementwicklung
Re: XSL Passthrough
Posted by Peter Armstrong <ar...@exoffice.com>.
> Does anybody have an XSL sheet which will pass through the source tree
> formatted in HTML - ie so you can view it in the browser.
>
> I just thought it could be really useful for debugging XSP pages
Here's my quick and dirty version. If you improve it please send me
your changes...
peter
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="http://www.w3.org/TR/xhtml1/strict">
<xsl:preserve-space elements="*"/>
<xsl:output method="html" indent="no" encoding="iso-8859-1"/>
<xsl:template match="/">
<html>
<head>
</head>
<body>
<pre>
<xsl:apply-templates select="*"/>
</pre>
</body>
</html>
</xsl:template>
<xsl:template match="*">
<xsl:for-each select="ancestor::*">
<xsl:text> </xsl:text>
</xsl:for-each>
<xsl:text><</xsl:text>
<xsl:value-of select="name(.)"/>
<xsl:for-each select="@*">
<xsl:text> </xsl:text>
<xsl:value-of select="name(.)"/>
<xsl:text>="</xsl:text>
<xsl:value-of select="."/>
<xsl:text>"</xsl:text>
</xsl:for-each>
<xsl:choose>
<xsl:when test="*|text()">
<xsl:text>>
</xsl:text>
<xsl:apply-templates select="*|text()"/>
<xsl:for-each select="ancestor::*">
<xsl:text> </xsl:text>
</xsl:for-each>
<xsl:text></</xsl:text>
<xsl:value-of select="name(.)"/>
<xsl:text>>
</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>/>
</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="text()">
<xsl:for-each select="ancestor::*">
<xsl:text> </xsl:text>
</xsl:for-each>
<xsl:copy/>
<xsl:text>
</xsl:text>
</xsl:template>
</xsl:stylesheet>