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

Namespace problem

Subject: Namespace problem
From: "Trevor Nicholls" <trevor@xxxxxxxxxxxxxxxxxx>
Date: Fri, 25 Sep 2009 02:38:32 +1200
 Namespace problem

Problem: I have an application which uses XML documents (conforming to a
particular DTD) and which transforms them via an existing stylesheet into
XML documents which conform to a different DTD. Multiple input documents are
combined into fewer output documents. It all works.

For perfectly good reasons I am changing the initial set of XML documents so
that they conform to a schema rather than a DTD. Now I am changing the
stylesheet which outputs the 2nd-DTD-conformant XML files, and I have hit a
difficulty - I'm sure it's something basic but haven't found the answer yet!

My root elements used to have local attributes, but now, thanks to the
miracle of XSD, they have two additional attributes, e.g.

The stylesheet generating the output XML creates the DTD declaration with
    encoding="UTF-8" />

and has some null templates suppressing attributes which are not needed in
the output documents, eg:
  <xsl:template match="@indx|@mark|@formatted" />
  <xsl:template match="@rowspan[string(.)='1']" />
  <xsl:template match="@colspan[string(.)='1']" />
  <xsl:template match="@xml:space" />

Using the last of these as a "template" :-) I added two new lines to the
stylesheet doing this job for the schema version of the input:
  <xsl:template match="@xsi:noNamespaceSchemaLocation" />
  <xsl:template match="@xmlns:xsi" />

These generate an error, because I haven't declared the namespaces, so I

to the <xsl:stylesheet> declaration, thinking this would drop both
attributes. I wasn't sure what to put in the xmlns:xmlns one, as xmlns seems
to be a bit of a special case. However whatever I try isn't helping: the
xsi:noNamespaceSchemaLocattion attribute is being dropped, but the
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" attribute is not.

Is there a solution (other than picking attributes to copy from a whitelist,
which is barely practicable here)?

Thanks for any help

Current Thread


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.
First Name
Last Name
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.