This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

How to navigate in an expression (sort of)


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]