|
Subject: Re: [xsl] Namespace problem From: david_n_bertoni@xxxxxxxxxx Date: Mon, 13 Sep 2004 13:27:39 -0700 |
> Hello -
>
> I may have spoken too soon when I said that using current() did the
trick.
> This apparently works in XalanJ, but XalanC v1.7 appears to have a
problem
> with namespace::* and doesn't evaluate namespace::*[starts-with(name(),
> substring-before(current()/parent::node()/@name,':'))] correctly.
>
> Unfortunately, I need to support XalanC v1.7, does anyone know of a way
to
> resolve a namespace URI from the prefix in XalanC 1.7?
This is a case where Xalan-C deviates from the XPath data model, and does
not have a namespace node for every in-scope namespace on every element.
The following stylesheet produces the desired result:
<?xml version="1.0"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
version="1.0">
<xsl:output encoding="utf-8" />
<xsl:template match="wsdl:operation">
<xsl:element name="operation">
<xsl:choose>
<xsl:when test="contains(parent::node()/@name,':')">
<xsl:variable name="ns"
select="substring-before(parent::node()/@name, ':')" />
<xsl:attribute name="portType_nspc">
<xsl:choose>
<xsl:when test="contains(parent::node()/@name,':')">
<xsl:value-of select="namespace::*[name() = $ns]"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of
select="ancestor::*[last()]/@targetNamespace"/>
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="portType_nspc"/>
</xsl:otherwise>
</xsl:choose>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
I've been tempted numerous times to fix this deviation, but the cases
where this has caused a problem have been extremely rare, and the cost in
memory overhead is considerable in many cases.
Dave
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] Namespace problem, Marc Schneider | Thread | Re: [xsl] Namespace problem, Marc Schneider |
| Re: [xsl] XSLT, XHTML, and default , Joseph Dane | Date | Re: [xsl] dynamically applying temp, Bruce D'Arcus |
| Month |