This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: How to navigate in an expression (sort of)
- To: "'xsl-list at lists dot mulberrytech dot com'" <xsl-list at lists dot mulberrytech dot com>
- Subject: RE: [xsl] How to navigate in an expression (sort of)
- From: Jay Walters <jwalters at netnumina dot com>
- Date: Thu, 8 Feb 2001 13:17:58 -0500
- Reply-To: xsl-list at lists dot mulberrytech dot com
Sorry, I wasn't too clear then... or else I've been taking that advice about
making my XSL much too verbose!
I'll try to make my question more clear... I've put a really truncated, but
hopefully illustrative bit of the XML input file I'm working with at the end
of the e-mail. The xmi.id attribute is of type ID and xmi.idref is of type
IDREF, so we can use id(@xmi.id) and id(@xmi.idref) with abandon.
The context is a template which is processing <Foundation.Core.Class
xmi.id="S.1">. What I want to do is select the node
<Foundation.Core.AssociationEnd xmi.id="G.2"> by navigating through the
<Foundation.Core.Classifier xmi.idref="S.1"> node.
What I have been doing is essentially ...
<xsl:template match="Foundation.Core.Class">
<xsl:variable name="foo">
<xsl:value-of select="@xmi.id"/>
</xsl:variable>
<xsl:value-of
select="//Foundation.core.Association/Foundation.Core.Association.connection
/Foundation.Core.AssociationEnd[Foundation.Core.AssociationEnd.type/Foundati
on.Core.Classifier/@xmi.id=$foo]">
I haven't had much luck or spent a lot of time trying to figure out how to
get the xmi.id attribute of the node from where the <xsl:value-of select> is
applied within the [] expression after I've navigated around a bit.
Is there a quick and clean expression for this?
Thanks in advance.
Jay Walters
----------------- XML -----------------
<Foundation.Core.Namespace.ownedElement>
<!-- From here -->
<Foundation.Core.Class xmi.id="S.1">
<Foundation.Core.ModelElement.name>Person</Foundation.Core.ModelElement.name
>
</Foundation.Core.Class>
<Foundation.Core.Class xmi.id="S.2">
<Foundation.Core.ModelElement.name>Place</Foundation.Core.ModelElement.name>
</Foundation.Core.Class>
<Foundation.Core.Association xmi.id="G.1">
<Foundation.Core.ModelElement.name>location</Foundation.Core.ModelElement.na
me>
<Foundation.Core.Association.connection>
<!-- I want to get to here -->
<Foundation.Core.AssociationEnd xmi.id="G.2">
<Foundation.Core.ModelElement.name>personEnd</Foundation.Core.ModelElement.n
ame>
<Foundation.Core.AssociationEnd.type>
<!-- This node links the AssociationEnd to a Class -->
<Foundation.Core.Classifier xmi.idref="S.1"/>
</Foundation.Core.AssociationEnd.type>
</Foundation.Core.AssociationEnd>
<Foundation.Core.AssociationEnd xmi.id="G.3">
<Foundation.Core.ModelElement.name>placeEnd</Foundation.Core.ModelElement.na
me>
<Foundation.Core.AssociationEnd.type>
<Foundation.Core.Classifier xmi.idref="S.2"/>
</Foundation.Core.AssociationEnd.type>
</Foundation.Core.AssociationEnd>
</Foundation.Core.Association.connection>
</Foundation.Core.Association>
</Foundation.Core.Namespace.ownedElement>
-----Original Message-----
From: David Carlisle [mailto:davidc@nag.co.uk]
Sent: Thursday, February 08, 2001 12:45 PM
To: xsl-list@lists.mulberrytech.com
Subject: Re: [xsl] How to navigate in an expression (sort of)
If your xmi.id attribute is of type ID then I think you just want
<xsl:apply-templates select="id(@xmi.id)"/>
David
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list