1
0
mirror of https://gitlab.gnome.org/GNOME/libxslt synced 2025-11-08 11:02:18 +03:00
Files
libxslt/tests/XSLTMark/prettyprint.xsl
Daniel Veillard fb0a57cf03 Jumbo patch, extended regression tests and fixed regression results:
- configure.in tests/Makefile.am tests/XSLTMark/* tests/multiple:
  added the XSLTMark in the regression tests as well as multiple
  output test from Ankh
- libxslt/functions.c libxslt/keys.c libxslt/transform.c
  libxslt/variables.c libxslt/xsltutils.c: applied William M. Brack
  patches and fixed a memory leak
- tests/docbook/result/html/*.html : updated the results after
  William's patch
- tests/xmlspec/REC-xml-20001006-review.html
  tests/xmlspec/REC-xml-20001006.html: libxml now don't invent
  an HTML doctype when serializing HTML result, but adds the
  encoding in ALT
Daniel
2001-04-02 15:13:28 +00:00

63 lines
1.9 KiB
XML

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" encoding="utf-8"/>
<xsl:template name="element">
<xsl:param name="indent" select="0"/>
<xsl:text>
</xsl:text>
<!-- this next one's a real kludge!! -->
<xsl:value-of select="substring (' ', 0, $indent * 3)"/>
<xsl:choose>
<xsl:when test="self::text()">
<span class="text">
<xsl:value-of select="normalize-space(.)"/>
</span>
</xsl:when>
<xsl:when test="self::*">
<span class="element">
<xsl:value-of select="concat('&lt;',name(.),'&gt;')"/>
</span>
<xsl:for-each select="node()">
<xsl:call-template name="element">
<xsl:with-param name="indent">
<xsl:value-of select="$indent + 1"/>
</xsl:with-param>
</xsl:call-template>
</xsl:for-each>
<xsl:text>
</xsl:text>
<xsl:value-of select="substring (' ', 0, $indent * 3)"/>
<span class="element">
<xsl:value-of select="concat('&lt;/',name(.),'&gt;')"/>
</span>
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template match="/">
<html>
<style>
body { background-color: #ffffff; }
.element { color: #447744; }
.text { color: #774444; }
</style>
<body>
<pre>
<xsl:for-each select="node()">
<xsl:call-template name="element">
<xsl:with-param name="indent">
1
</xsl:with-param>
</xsl:call-template>
</xsl:for-each>
</pre>
</body>
</html>
</xsl:template>
</xsl:stylesheet>