Subject: RE: [xsl] How to move all Namespace-URLs declarations from Elements to Header with XSLT script? From: "Michael Kay" <mike@xxxxxxxxxxxx> Date: Fri, 9 Oct 2009 19:20:57 +0100 |
To move all namespace declarations to the top level: <xsl:template match="/*"> <xsl:copy> <xsl:copy-of select="@*, //namespace::*, child::node()"/> </xsl:copy> </xsl:template> To move all namespace declarations as far down as they will go: <xsl:template match="/"> <xsl:copy-of select="." copy-namespaces="no"/> </xsl:template> Michael Kay http://www.saxonica.com/ http://twitter.com/michaelhkay > -----Original Message----- > From: Ben Stover [mailto:bxstover@xxxxxxxxxxx] > Sent: 09 October 2009 08:41 > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx > Subject: [xsl] How to move all Namespace-URLs declarations > from Elements to Header with XSLT script? > > Assume I get an XML doc where (almost) ALL <Element> tags > contain the full Namespace URL for a possibly used > Namespace-Prefix similar to: > > <mydummyelement> > <paul:mysubdummyelement1 > xmlns:paul="http://www.somedomain.com/aaa/bbb/ccc/ddd/eee/"/> > <paul:mysubdummyelement2 > xmlns:paul="http://www.somedomain.com/aaa/bbb/ccc/ddd/eee/"/> > </mydummyelement> > > How can I move with an XSLT script the Namespace-URLs out of > all elements and group them, remove duplicates and put them > in the top-most element similar to > > <mydummyelement > xmlns:paul="http://www.somedomain.com/aaa/bbb/ccc/ddd/eee/"> > <paul:mysubdummyelement1/> > <paul:mysubdummyelement2/> > </mydummyelement> > > And how can I do the reverse way with the XSLT script? > > Thank you > Ben
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] How to move all Namespace, Jesper Tverskov | Thread | [xsl] Testing a variable for node, rowan@xxxxxxxxxxxxxx |
RE: [xsl] collection() issue with d, Michael Kay | Date | [xsl] Modifying namespace definitio, Wolfgang Laun |
Month |