Reputation: 1
I am a beginner in XSLT. Could anybody please help me understand how to retrieve an xsd's target namespace in an XSL transformation? I have tried using the document function with the absolute path of the xsd file passed as the parameter but in vain.
All I am trying to achieve is retrieve an xsd's target namespace in an XSL transformation.
this is what I have been using to check if the xsd's in my document are being pushed inot the styelsheet. The count returned is zero that inplies that xsd's are not being fed. Could anybody please help me understand how to I esnure my stylesheet picks up the xsd's in the project directory.Please let me know if you need any further infomration TNS -
Upvotes: 0
Views: 763
Reputation: 1
<xsl:variable name="tns" select="string(/xs:schema/@targetNamespace)"/>
<xsl:message> TNS
<xsl:value-of select="$tns" > </xsl:value-of>
<xsl:value-of select="/xs:schema/@targetNamespace" > </xsl:value-of>
</xsl:message>
Upvotes: 0
Reputation: 25044
If you have the XSD schema document, then retrieving the target namespace is as simple as
<xsl:variable name="tns" select="$xsd/xsd:schema/@targetNamespace"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"/>
If you're having trouble loading the XSD schema document, then your problem is not getting the target namespace but loading an external document.
Upvotes: 1