W3C home > Mailing lists > Public > xml-uri@w3.org > August 2002

Re: xml namespace

From: Norman Walsh <Norman.Walsh@Sun.COM>
Date: Fri, 02 Aug 2002 14:58:58 -0500
To: "Mridula Mahadevan" <mridula.mahadevan@demandtec.com>(by way of Martin Duerst <duerst@w3.org>)
Cc: xml-uri@w3.org
Message-ID: <87it2t3ud9.fsf@nwalsh.com>

/ "Mridula Mahadevan" <mridula.mahadevan@demandtec.com>(by way of Martin Duerst <duerst@w3.org>) was heard to say:
|      I am conversant with xml/xsl hence this question.
| I am trying to generate a html file from my xml using xsl and
| javax.xml.transform.transformer class. When i include the namespace in
| the xml root node (uri) i dont get any xml but if i dont include the
| html is generated according to the xsl. Is there a way i can force the
| transformer to not validate the uri?

No, but you can probably change the match patterns in your stylesheet.
Given:

  <document xmlns="urn:publicid:-:Norman+Walsh:Whatever:EN">
    <para/>
  </document>

you may be surprised that the following template will not match the
para in the preceding document, *regardless* of the default namespace
of your stylesheet:

  <xsl:template match="para">
    ...
  </xsl:template>

Instead, you must provide a QName with a prefix:

  <xsl:stylesheet xmlns:my="urn:publicid:-:Norman+Walsh:Whatever:EN"
                  xmlns:xsl="..."
                  ...>

  <xsl:template match="my:para">
    ...
  </xsl:template>

If the problem is more complex than that, you'll probably have to post
a little more context for us.

                                        Be seeing you,
                                          norm

P.S. This is really an XSLT question and probably belongs on another list.

-- 
Norman.Walsh@Sun.COM    | Wisdom comes with age, but sometimes age
XML Standards Architect | comes alone.
Sun Microsystems, Inc.  | 
Received on Saturday, 3 August 2002 10:09:04 GMT

This archive was generated by hypermail 2.2.0 + w3c-0.30 : Tuesday, 12 April 2005 12:17:27 GMT