Subject:Grabbing sub-namespace values Author:Karen Fox Date:04 Nov 2008 01:21 PM
I'm pulling schemas out of WSDLs but have one problem. Because I have to match on a variety of schema elements, I'm trying to be as generic as possible on matching the schema elements.
How can I grab the namespace values associated with this schema element? I've tried many different ways but nothing works. I can't use copy/copy-of for this since it messes up other things I have to do.
Example WSDL: All I want are the wsdl and soapenc namespaces.
Subject:Grabbing sub-namespace values Author:(Deleted User) Date:06 Nov 2008 03:35 AM
Hi Karen,
the prefix used in the WSDL you are processing is not important, what you really need is the namespace that prefix is mapped to.
So, writing in your XSLT
<xsl:template match="xsd:schema">
(after having associated "xsd" to the XML Schema namespace in the xsl:stylesheet element) is enough to match either s:schema or a:schema.
As for what you are trying to extract: in XSLT 1.0 you can use the "namespace" axis to retrieve the namespace nodes that are in scope at a specified level, including the one defined there and the one inherited from the parent node. In XSLT 2.0 you can use the in-scope-prefixes() function.