[xsl] How to navigate in an expression (sort of)

Subject: [xsl] How to navigate in an expression (sort of)
From: Jay Walters <jwalters@xxxxxxxxxxxxx>
Date: Thu, 8 Feb 2001 09:50:55 -0500
I am generating Java code from XMI files using XSLT.  For the lucky out
there, XMI is a standard DTD for representing UML models very verbosely;-).
I'm using Xalan 1.2 to do my processing.

I often find myself in the position of needing to find a node which points
to the current node using a cross reference (ID/IDREF).  An example I've
shown below is looking for all the association ends which refer to the
specific class I'm processing.  I haven't yet figured out a better way of
expressing this operation than something like

<xsl:template match="Foundation.Core.Class">

    <xsl:variable name="id">
      <xsl:value-of select="@xmi.id"/>
    </xsl:variable>

    <xsl:apply-templates
select="//Foundation.Core.Association/Foundation.Core.Association.connection
/Foundation.Core.AssociationEnd[Foundation.Core.AssociationEnd.type/Foundati
on.Core.Classifier/@xmi.idref=$id]"/>
....

What is the XSL idiom for getting this task done?  What I have works, but
does not feel elegant in the least.

Cheers
Jay Walters

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread