[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

problem with a example of the book Beginning xml and

Subject: 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
 problem with a example of the book Beginning xml and
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.