XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Karen FoxSubject: 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.

<xsl:template match="s:schema | a:schema | xsd:schema | schema">

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.

<?xml version="1.0" encoding="UTF-8"?>
<definitions name="PriceListService"

<schema xmlns="http://www.w3.org/2001/XMLSchema"

<complexType name="ArrayOfString">
<restriction base="soapenc:Array">
<attribute ref="soapenc:arrayType"
<complexType name="ArrayOfDouble">
<restriction base="soapenc:Array">
<attribute ref="soapenc:arrayType"


Karen Fox

(Deleted User) 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.

Hope this helps,

Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.