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

Trouble with namespaces and running identity transform

Subject: Trouble with namespaces and running identity transform on XHTML
From: "James J. Ramsey" <jjramsey_6x9eq42@xxxxxxxxx>
Date: Tue, 9 Mar 2004 13:49:56 -0800 (PST)
identity transform doctype
I've been working on a stylesheet to "massage" some
XHTML. One variation of a test stylesheet is here:

<xsl:transform
   xmlns:h="http://www.w3.org/1999/xhtml"
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
   version='1.0'>

<xsl:output method="xml"/>

<xsl:template match="h:h1|h:h2">
<p>
   LOOK MA! <xsl:apply-templates select="@*|node()"/>
NO BRAINS!
</p>
</xsl:template>

<xsl:template match="@*|node()">
  <xsl:copy>
    <xsl:apply-templates select="@*|node()"/>
  </xsl:copy>
</xsl:template>

</xsl:transform>

I have four test documents that look something like
this:
                                                      
                         
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Transitional//EN"
  
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="test_head_attr">
<title>Sample title</title>
</head>
<body id="test_body_attr">
<h1>Sample H1</h1>
<h2>Sample H2</h2>
<p>Body text
<br />
Other stuff.
<br /></p>
</body>
</html>

One of the four has both the DOCTYPE declaration and
an xmlns attribute, one has the DOCTYPE declaration
but no xmlns attribute, one has no DOCTYPE declaration
but an xmlns attribute, and one has neither a DOCTYPE
declaration nor an xmlns attribute. I'd *like* to get
a stylesheet that produced the same results on all
four test documents, but I'd settle for getting it to
work on the documents that set the xmlns attribute
explicitly in the html element and the documents with
the DOCTYPE declaration.

I've tried variants on this with the
exclude-result-prefixes attribute of xsl:stylesheet
and also tried messing with the xsl:namespace-alias
element, but can't seem to this to produce the same
output on both xsltproc and Saxon, and I keep getting
invalid output with attributes like xmlns="" or
xmlns:h="http://www.w3.org/1999/xhtml".

Any idea how to do this right?

__________________________________
Do you Yahoo!?
Yahoo! Search - Find what you?re looking for faster
http://search.yahoo.com

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.