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

Creating HTML and XHTML with one stylesheet with name

Subject: Creating HTML and XHTML with one stylesheet with namespace-alias
From: Deborah Pickett <debbiep-list-xsl@xxxxxxxxxx>
Date: Mon, 03 Sep 2007 10:04:53 +1000
 Creating HTML and XHTML with one stylesheet with  name
Can someone please confirm if what I'm doing here conforms to the XSLT
1.0 spec?  It seems to crash Xalan-J 2.7.0, but Saxon 6 and MSXML 4 do
what I want.  (XSLT 2.0 clearly states that this works, and indeed Saxon
8 does so.)

I am using a large stylesheet, call it foo2html.xsl, which generates
HTML 4 (un-namespaced, as HTML should be) using literal result elements:
  <!-- Lots of templates like this. -->
  <xsl:template match="/foo">
    <html>
      <xsl:apply-templates/>
    </html>
  </xsl:template>

I want to use that same stylesheet to generate equivalent,
properly-namespaced, XHTML 1.0, by importing it into a "shell"
stylesheet that maps the null namespace to the XHTML namespace.  I use
xsl:namespace-alias to map the default namespace prefix, in this case no
namespace, to the XHTML namespace.

<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:xhtml="http://www.w3.org/1999/xhtml/">
  <xsl:import href="foo2html.xsl"/>
  <xsl:output method="xml" doctype-system=
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
    doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" />
  <xsl:namespace-alias
    stylesheet-prefix="#default"
    result-prefix="xhtml"/>
</xsl:stylesheet>

I'm not fussy about whether the output makes use of default namespaces
or not, provided that it's valid XHTML.  I would prefer to do the
transform in one pass.

Specifically, what I want to know is:
Is is allowed for namespace-alias to map the null namespace in XSLT 1.0?

Thanks.

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

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

Buy Stylus Studio Now

Cast Your Vote

We need your help – Vote for DataDirect XML Products!

  • Best SOA or XML site

Winners and finalists announced at SOA World Conference in November.

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-2007 All Rights Reserved.