Re: keys and idrefs
With XML such as <process id="schemaDesign" layer="datalayer" control="XAG systemArchitecture" input="systemSpec "> <name>Schema Design</name> </process>
So you want process elements back, using @control:
<xsl:key name="processes-by-control" match="process" use="@control"/>
High-level aside: I think the hardest thing about using a key is getting the right key defined, and I find the easiest way to define the right key is to find a name for it that describes what it is (hey I'm a poet not a mathematician). I also find the English preposition "by" to be very useful here because it encapsulates how key relationships work -- you're getting something back by means of something else related to it. The something you get back is the match pattern; the something else you're using is the use expression. So my key names are commonly "x-by-y" where x is the pattern, y is the use expression. Makes it easier to think through (and to understand the code).
in the template for 'document' I'm using the hack
to get back all process elements whose @control attribute is the same as the @id attribute of the context node.
But I'm a bit confused by your expression "id(//process|//document[@control='$thisDoc'])". This reads to me as though you'll get all elements whose attribute of type ID is the same as the *content* of any <process> element or of any <document> element with @control = '$thisdoc' (the string, not the variable) ... stressing "content" because a node-set argument to the id() function acts as though giving it a set of strings. I don't think this'll work.
Since you want <process> elements back and @control on each process is an IDREF, not an ID, I think you have to use keys; the id() function only goes the other way.
If I'm not reading the requirement right, more clarification?
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format