This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
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: [xsl] How to navigate in an expression (sort of)
- From: Jay Walters <jwalters at netnumina dot com>
- Date: Thu, 8 Feb 2001 09:50:55 -0500
- Reply-To: xsl-list at lists dot mulberrytech dot com
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