|
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- product.xsl - Input Dokument -->
<xsl:output method="html"/>
<xsl:template match="/">
<HTML>
<HEAD>
<TITLE>product.xsl</TITLE>
</HEAD>
<BODY>
<xsl:apply-templates select="shop"/>
</BODY>
</HTML>
</xsl:template>
<xsl:template match="shop">
<xsl:comment> product.xsl </xsl:comment>
<xsl:apply-templates select="order/product"/>
</xsl:template>
<xsl:template match="product">
<TABLE>
<TR>
<TD WIDTH="150"><xsl:value-of select="@department"/></TD>
<TD WIDTH="100"><xsl:value-of select="name"/></TD>
<TD WIDTH="100" ALIGN="RIGHT">
<xsl:value-of select="price"/>
<xsl:text> </xsl:text>
<xsl:value-of select="currency"/>
</TD>
</TR>
</TABLE>
</xsl:template>
</xsl:stylesheet>
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html"/>
<xsl:template match="/">
<HTML>
<HEAD>
<TITLE>Funktion: name() /
Beispiel 01</TITLE>
</HEAD>
<BODY>
<xsl:call-template name="example"/>
</BODY>
</HTML>
</xsl:template>
<xsl:template name="example">
<TABLE BORDER="1">
<TR>
<TH WIDTH="100">Element:</TH>
<TH WIDTH="100">Prefix:</TH>
<TH WIDTH="100">Local Name:</TH>
<TH>Namespace URI:</TH>
</TR>
<xsl:apply-templates select="//*">
<xsl:sort select="namespace-uri()"/>
<xsl:sort select="local-name()"/>
</xsl:apply-templates>
</TABLE>
</xsl:template>
<xsl:template match="*">
<xsl:variable name="prefix">
<xsl:if test="contains(name(), ':')">
<xsl:value-of select="substring-before(name(), ':')"/>
</xsl:if>
</xsl:variable>
<TR>
<TD><xsl:value-of select="name()"/></TD>
<TD><xsl:value-of select="$prefix"/></TD>
<TD><xsl:value-of select="local-name()"/></TD>
<TD><xsl:value-of select="namespace-uri()"/></TD>
</TR>
</xsl:template>
</xsl:stylesheet>
|