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

RE: How to navigate in an expression (sort of)

Subject: RE: How to navigate in an expression (sort of)
From: Jay Walters <jwalters@xxxxxxxxxxxxx>
Date: Thu, 8 Feb 2001 13:17:58 -0500
foundation.core.modelelement
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@xxxxxxxxx]
Sent: Thursday, February 08, 2001 12:45 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re:  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


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.