xsl-list
[Top] [All Lists]

[xsl] key declarations (using a sequence constructor)

2009-10-06 13:22:32
Hi,

I'm playing around with the added features available in key
declarations but I think I must be misunderstanding
something.  Here's my key declaration (I realize that this particular
example would be better as a simple
@use but I want to understand how it works to see if it might make
some of my other keys look a little
better)....

  <xsl:key name="keyNames"
                   match="name | mdv">
        <lookup oid="{(_at_)oid}"/>
  </xsl:key>

and an example input document is something like...

<timaeus-names xmlns:odm="http://www.cdisc.org/ns/odm/v1.3";>
  <mdv oid="TEST/M/oids" name="TESTMOIDS">
    <name oid="S001" parent-oid="" name="S001" />
    <name oid="F001" parent-oid="S001" name="F001" />
    <name oid="IG001" parent-oid="F001" name="IG001" />
    <name oid="AA.AA" parent-oid="IG001" name="AAAA" />
    <name oid="AA..AA" parent-oid="IG001" name="AAAA2" />
    <name oid="AA...AA" parent-oid="IG001" name="AAAA3" />
  </mdv>
</timaeus-names>

I thought that to use this key to lookup the @name associated with
@oid="AA.AA" for example, I'd do

        <xsl:variable name="lookup">
          <lookup oid="AA.AA"/>
        </xsl:variable>
        <xsl:sequence select="key('keyNames', $lookup)/@name"/>

But this actually returns a sequence containing all the @names.

I seek enlightenment as to why this is so :-)

--
Andy

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--