xsl-list
[Top] [All Lists]

RE: Namespace issues

2005-05-19 08:04:48
My suggestion in such cases would be to write a transformation that moves
the elements into the required namespace (or into the null namespace), and
then apply the second transformation: that is, solve it using a pipeline,
rather than trying to write one stylesheet that understands both formats.

Michael Kay
http://www.saxonica.com/ 

-----Original Message-----
From: Joel Håkansson [mailto:joel(_dot_)hakansson(_at_)tpb(_dot_)se] 
Sent: 19 May 2005 15:54
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] Namespace issues


I have two different versions of an XML-format. The first one contains
no namespace declaration and the second (newer) contains a 
value for the
default namespace in the root-element.

Thus to match elements in the newer spec. I have to write for example
match="myns:root" while in to match elements in the older spec. I can
use match="root".

If I already have an XSLT that transforms the older version and would
like to apply that to a document following the newer specs, I have two
options:
1) Remove the xmlns declaration from the source document before
applying the transformation
2) Rewrite the xslt, like
  <xsl:stylesheet xmlns:myns="..."...
    <xsl:template match="myns:root"...

Consequently, if I want a single stylesheet transforming both 
versions,
I have to use:
  <xsl:template match="root|myns:root"> and so on

Have I got it right?

Joel

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--





--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>