Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


RE: [xsl] Wildcards in namespaces ?

From: "Michael Kay" <mhk@--------->
To:
Date: 7/1/2004 1:56:00 PM
XPath 2.0 allows constructs of the form *:local which will match local in
any namespace, but there's no way of matching a set of namespaces.

I would recommend using a first transformation pass to normalize the
namespace URI, to keep this separate from the "real" transformation logic.
This is just a variant on the identity template:

<xsl:template match="one-uri:*">
  <xsl:element name="{local-name}" namespace="two-uri">
    <xsl:copy-of select="@*"/>
    <xsl:apply-templates/>
  </xsl:element>
</xsl:template>

Michael Kay 

> -----Original Message-----
> From: Mick Baggen [mailto:mick.baggen@xxxxxxxxxxxxxxx] 
> Sent: 01 July 2004 08:30
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: [xsl] Wildcards in namespaces ?
> 
> Hello,
> 
> I would appreciate some help with the following problem:
> 
> I'm writing a XSLT stylesheet for processing of UML XMI files. Alas,
> depending on the UML tool, the elements in the XMI file are 
> placed in a
> different namespace. E.g. Poseidon (www.gentleware.com) uses the
> namespace-URI xmlns:UML = "org.omg.xmi.namespace.UML", and 
> Rational Rose
> uses xmlns:UML = "href://org.omg/UML/1.3". However, all of 
> them generate a
> prefix UML: for their XMI elements.
> 
> Now my problem is: how can I define a namespace in my XSLT 
> stylesheet so
> that I can process all XMI files with the SAME stylesheet ? I 
> came across a
> remark on the XSLT FAQ suggesting that it is possible to use 
> wildcards in
> the namespace, eg <xsl:stylesheet xmlns:UML="*UML*">. And 
> indeed, it seems
> that Xalan 2.6.0 recognizes this notation. However, libxslt 1.1.6
> (xmlsoft.org) does not.
> 
> I tried to look it up in the XSLT and XML Namespace 
> specifications, but I
> couldn't find whether this is valid. Could someone help me 
> out on this one ?
> If it is NOT valid XSLT, is there another way to achieve the 
> same result ?
> 
> Regards,
> 
> Mick Baggen
> Principal Consultant
> Technolution B.V.
> E-mail: 	 mick.baggen@xxxxxxxxxxxxxxx
> 
> 
> --+------------------------------------------------------------------
> 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@xxxxxxxxxxxxxxxxxxxxxx>
> --+--
> 
>


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent