Subject: [xsl] problem with a example of the book Beginning xml and xpath transformation From: Roelof Wobben <rwobben@xxxxxxxxxxx> Date: Sat, 10 Dec 2011 14:59:00 +0000 |
Hello, I have this xml file: <?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet href="step1.xsl" type="text/xsl"?> <reference xml:id="xsl_stylesheet"> <body> <title>xsl:stylesheet</title> <purpose> <p>The root element of a stylesheet.</p> </purpose> <usage> <p>The <element>xsl:stylesheet</element> is always the root element, even if a stylesheet is included in, or imported into another. It must have a <attr>version</attr> attribute, indicating the version of XSLT that the stylesheet requires.</p> <p>For this version of XSLT, the value should normally be <code>"2.0"</code>. For a stylesheet designed to execute under either XSLT 1.0 or XSLT 2.0, create a core module for each version number; then use <element>xsl:include</element> or <element>xsl:import</element> to incorporate common code. which should specify <code>version="2.0"</code> if it uses XSLT 2.0 features, or <code>version="1.0"</code> otherwise.</p> <p>The <element>xsl:transform</element> element is allowed as a synonym.</p> <p>The namespace declaration <code>xmlns:xsl="http//www.w3.org/1999/XSL/Transform</code> by convention uses the prefix <code>xsl</code>.</p> <p>An element occurring as a child of the <element>xsl:stylesheet</element> element is called a declaration. These top-level elements are all optional, and may occur zero or more times.</p> </usage> </body> </reference> And according to the book this xslt must work : <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-Strict.dtd" omit-xml-declaration="yes" encoding="UTF-8" indent="yes" /> <xsl:template match="/"> <html> <head> <title> <xsl:apply-templates select="body/reference" /> </title> </head> <body> <p>Dit is een test</p> </body> </html> </xsl:template> </xsl:stylesheet> But as output I get this : DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-Strict.dtd"><html> <head> <title/> </head> <body> <p>Dit is een test</p> </body> </html> As you can see the title tag is messed up. Can anyone help me figure out what is wrong here? Roelof
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Translating the new lines, Soyer, Muhammed A. | Thread | Re: [xsl] problem with a example of, Geert Bormans |
Re: [xsl] Dealing mixed content wit, Brandon Ibach | Date | Re: [xsl] problem with a example of, Geert Bormans |
Month |