Hallo,
kann mir vielleicht jemand erklären, wie man ein solches xml:styleshett >> ließt? Komisch ist hier vorallem der "call-template" aufruf "WasTueIch" >> im template name WasTueIch.
xml Dokument:
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="docbook.xsl"?>
<!--Dies ist ein DocBook-Dokument-->
<book lang="de">
<title>Ein sehr einfaches Buch</title>
<chapter>
<title>Einführung DocBook</title>
<para>So ist das also</para>
</chapter>
</book>xsl:stylesheet:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="html"/><xsl:template name="WasTueIch">
<xsl:param name="text"/>
<xsl:variable name="ntext" select="normalize-space($text)"/>
xsl:choose
<xsl:when test="$ntext">
<xsl:variable name="remainder">
<xsl:call-template name="WasTueIch">
<xsl:with-param name="text" select="substring-after($ntext,'')"/>
</xsl:call-template>
</xsl:variable>
<xsl:value-of select="$remainder + 1"/>
</xsl:when>
xsl:otherwise0</xsl:otherwise>
</xsl:choose>
</xsl:template><xsl:template match="/">
<html>
<head>
<title>WasTueIch</title>
</head>
<body>
<xsl:for-each select="//*">
<xsl:variable name="length">
<xsl:call-template name="WasTueIch">
<xsl:with-param name="text" select="."/>
</xsl:call-template>
</xsl:variable>
<xsl:value-of select="name()"/>
xsl:text: </xsl:text>
<xsl:value-of select="$length"/>
<br/>
</xsl:for-each>
</body>
</html>
</xsl:template>
</xsl:stylesheet>Vielen Dank im voraus
Daniel