This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 185197

Summary: [69cat] XML: XSLT Template Designed for HTML; process doesn't consider XML or TEXT output methods
Product: xml Reporter: gliesian <gliesian>
Component: CodeAssignee: issues@xml <issues>
Status: NEW ---    
Severity: normal CC: sdedic
Priority: P4    
Version: 7.0.1   
Hardware: PC   
OS: Windows XP   
Issue Type: ENHANCEMENT Exception Reporter:

Description gliesian 2010-04-28 16:16:48 UTC
The XSLT standard includes "xml", "html", "text", and Qualified Names output methods for its configuration.  However, the template provided by NetBeans (Ctrl-N, XML, XSL Stylesheet) creates a template for the 'html' output method only: 

  <?xml version="1.0" encoding="UTF-8"?>
  <!--
      Document   : newstylesheet1.xsl
      Created on : April 28, 2010, 12:03 PM
      Author     : ...
      Description:
          Purpose of transformation follows.
  -->
  <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"   version="1.0">
      <xsl:output method="html"/>

      <!-- TODO customize transformation rules 
           syntax recommendation http://www.w3.org/TR/xslt 
      -->
      <xsl:template match="/">
          <html>
              <head>
                  <title>newstylesheet1.xsl</title>
              </head>
              <body>
              </body>
          </html>
      </xsl:template>
  </xsl:stylesheet>  

I recommend adding a step to the wizard to create three separate templates (xml, html and text)... either that or create a more generic template as was done by Eclipse:

  <?xml version="1.0" encoding="UTF-8"?>
  <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
     <xsl:template match="/">
		<!-- TODO: Auto-generated template -->
     </xsl:template>
  </xsl:stylesheet>

Just FYI, Altova XMLSpy sets 'xml' as their default output:

  <?xml version="1.0" encoding="UTF-8"?>
  <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
  </xsl:stylesheet>

From (http://www.w3.org/1999/XSL/Transform):
XSL Transformations (XSLT)
Version 1.0
W3C Recommendation 16 November 1999

16.1 XML Output Method
The xml output method outputs the result tree as a well-formed XML external general parsed entity. If the root node of the result tree has a single element node child and no text node children, then the entity should also be a well-formed XML document entity.

16.2 HTML Output Method
The html output method outputs the result tree as HTML

16.3 Text Output Method
The text output method outputs the result tree by outputting the string-value of every text node in the result tree in document order without any escaping.