[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: xsd:import and namespaces

Subject: RE: xsd:import and namespaces
From: Sundar Shanmugasundaram <SSHANMUGASUNDARAM@xxxxxxxxxxxxx>
Date: Thu, 24 Apr 2003 10:29:05 +0530
access xsd
To access the value of schemaLocation,
use the following expression:

<xsl:variable name="schema" select="../xsd:import/@schemaLocation"/>

regards,
sundar

-----Original Message-----
From: Peter Moore [mailto:pmoore@xxxxxxx]
Sent: Thursday, April 24, 2003 3:39 AM
To: XSL-List@xxxxxxxxxxxxxxxxxxxxxx
Subject:  xsd:import and namespaces


How can I get the value of schemaLocation from the xsd:element/@ref 
attribute in the following XML Schema sample:

...
<xsd:schema ... xmlns:xxx="http://www.yo.com/example.namespace">
<xsd:import namespace="http://www.yo.com/example.namespace" 
schemaLocation="http://www.yo.com/example.xsd"/>
...
<xsd:element ref="xxx:SomeName"/>
...

My xsl looks something like this:

...
<xsl:template match="xsd:element[@ref]">
	<xsl:element name="{@ref}">
		<xsl:variable name="schema" 
select="//xsd:import/@schemaLocation[../@namespace=???]"/>

		<xsl:apply-templates 
select="document($schema)//element[@name=current()/@ref]"/>
	</xsl:element>
</xsl:template>
...

Am I on the right track? If so, what should replace the ??? in the 
location path? If I remove the stuff between the xsl:element tags I get 
the following output:

...
	<xxx:SomeName xmlns:xxx="http://www.yo.com/example.namespace"/>
...

So XSLT knows the namespace I want...I just don't know how to ask it.

Thanks.

BTW...I'm using LibXSLT and perl for the transform.


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.