text.xml:
<?xml version="1.0" standalone="yes"?> <?xml-stylesheet type="text/xsl" href="./test.xsl"?> <root> <paramlist> <param id="2">wartość</param> <param id="3">wartość2</param> <param id="6">wartość3</param> </paramlist> </root>
text.xsl:
<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="html" encoding="UTF-8" doctype-public="-//W3C//DTD HTML 4.01//EN" doctype-system="http://www.w3.org/TR/html4/strict.dtd" /> <xsl:template match="/"> <xsl:apply-templates/> </xsl:template> <xsl:template match="root"> <html> <head> <meta content="text/html; charset=UTF-8" http-equiv="content-type"/> <title> Example </title> </head> <body> <xsl:if test="paramlist/node()"> <h1>Lista parametrów</h1><ul> <xsl:for-each select="paramlist"> <li/> <xsl:value-of select="param"/> </xsl:for-each> </ul> </xsl:if> </body> </html> </xsl:template> </xsl:stylesheet>
Spodziewany rezultat:
Otrzymany rezultat:
Co robię nie tak?