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
Conferences Close Tree View
+ Stylus Studio Feature Requests (1192)
+ Stylus Studio Technical Forum (14621)
+ Website Feedback (249)
- XSLT Help and Discussion (7625)
-> + Use of before and after string (3) Sticky Topic
-> - How do I substitute element ty... (1)
-> + How does one add working days ... (4)
-> - Help, I have existing XLT and... (1)
-> + Need help on XSLT issue - (2)
-> + EDI to XML Conversion (7)
-> - XML To JSON Conversion using X... (1)
-> + Formatting Paragraphs to same ... (2)
-> - Grouping of records (1)
-> + Problems with xsd 1.1 (4)
-> + XML to HL7 mapping (3)
-> + XSLT 3 and Iterate (2)
-> + XSL-FO to PDF preview (3)
-> + java.lang.RuntimeException: Er... (2)
-> + Create Acroforms with Stylus X... (2)
-> + How to change XSLT parameter s... (3)
-> + how to change format of the da... (2)
-> + Search "Next 8 Results " doesn... (2)
-> - Support for Git (1)
-> + newbee (8)
-- [1-20] [21-40] [41-60] Next
+ XQuery Help and Discussion (2016)
+ Stylus Studio FAQs (159)
+ Stylus Studio Code Samples & Utilities (364)
+ Stylus Studio Announcements (113)
Topic  
Postnext
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"
targetNamespace="http://www.ecerami.com/wsdl/PriceListService.wsdl"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://www.ecerami.com/wsdl/PriceListService.wsdl"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsd1="http://www.ecerami.com/schema">

<types>
<schema xmlns="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.ecerami.com/schema"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">

<complexType name="ArrayOfString">
<complexContent>
<restriction base="soapenc:Array">
<attribute ref="soapenc:arrayType"
wsdl:arrayType="string[]"/>
</restriction>
</complexContent>
</complexType>
<complexType name="ArrayOfDouble">
<complexContent>
<restriction base="soapenc:Array">
<attribute ref="soapenc:arrayType"
wsdl:arrayType="double[]"/>
</restriction>
</complexContent>
</complexType>
</schema>
</types>

Thanks!

Karen Fox
kfox@mitre.org

Posttop
(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,
Alberto

   
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!  
go

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.