Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: xpath problems?

From: "Joris Gillis" <joris.gillis@-------.--------.-->
To: NULL
Date: 6/5/2006 8:00:00 PM

On Mon, 05 Jun 2006 19:19:58 +0200, Jeremy Chapman <please@Idontlikespam=
>  =

wrote:

> Thanks.  I used local names because sometimes some of the nodes had ns=
0
> prefixes, and some of them had xsd, so rather than use local names onl=
y  =

> in
> certain spots where the namespace may change I just used it everywhere=
 to
> keep it uniform throughout the transform. One of those things that see=
med
> like a good idea at the time.

As long as those alternative prefixes are bound to the same namespace,  =

they are virtually indistinguishable for XSLT. This means you can use  =

'xsd:foo' to match 'nso:foo' nodes.


>
> "Joris Gillis" <joris.gillis@s...> wrote in message
> news:op.taj71iol62ysdy@j......
> On Fri, 02 Jun 2006 23:43:30 +0200, Jeremy Chapman <please@Idontlikesp=
am>
> wrote:
>
>> Are you saying the <xsl:value-of
>> select=3D"/*[local-name()=3D'config']/*[local-name()=3D'xsddocs']/@hr=
ef"/>
>> statement is working on the $doc nodeset because of the <for-each tha=
t
>> its in?
>
> He would be correct in saying that
>
>> If so,  how would I work on the non external document?
>
> You could "backup" your original document context by saving it in a
> variable:
>
> <xsl:variable name=3D"this" select=3D"/"/>
>   <xsl:for-each
> select=3D"$doc/*[local-name()=3D'schema']/*[local-name()=3D'element'][=
@name=3D$strRootReference]/*[local-name()=3D'complexType']/*[local-name(=
)=3D'sequence']/*[local-name()=3D'element']">
>    <xsl:value-of
> select=3D"$this/*[local-name()=3D'config']/*[local-name()=3D'xsddocs']=
/@href"/>
> </xsl:for-each>
>
> On a sidenote, what's with all the local-name()'s? Wouldn't
> "$doc/sxd:schema/sxd:element[@name=3D$strRootReference]/sxd:complexTyp=
e/sxd:sequence/sxd:element"
> be more readable?
>
>> "Anthony Jones" <Ant@y...> wrote in message
>> news:uB2vLtohGHA.4252@T......
>>>
>>> "Jeremy Chapman" <please@Idontlikespam> wrote in message
>>> news:u3cEN%23lhGHA.1000@T......
>>>> Code snippet below (shortened for illustration purposes)
>>>> My problem is that if I move the <xsl:value-of statement to the fir=
st
>>>> line
>>>> under <xsl:template match=3D"/"> then it returns the @href attribut=
e as  =

>>>> I
>>>> would expect.  But if I leave it as shown below,  it doesn't return=
 a
>>> value,
>>>> but I don't understand why.  Can someone shed some light?
>>>>
>>>> <xsl:template match=3D"/">
>>>>  <xsl:call-template name=3D"processSegmentDetails" >
>>>> </xsl:template>
>>>>
>>>> <xsl:template name=3D"processSegmentDetails">
>>>>  <xsl:for-each
>>>>
>>> select=3D"$doc/*[local-name()=3D'schema']/*[local-name()=3D'element'=
][@name=3D$strRo
>>> otReference]/*[local-name()=3D'complexType']/*[local-name()=3D'seque=
nce']/*[loca
>>> l-name()=3D'element']">
>>>>   <xsl:value-of
>>>> select=3D"/*[local-name()=3D'config']/*[local-name()=3D'xsddocs']/@=
href"/>
>>>> </xsl:template>
>>>>
>>>>
>>>
>>> Where does $doc get it's nodes from?
>>>
>>>
>>
>>
>
>

regards,
-- =

Joris Gillis (http://users.telenet.be/root-jg/me.html)
Veni, vidi, wiki (http://www.wikipedia.org)


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent