This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
using keys as cross-reference
- From: Xiaocun Xu <xiaocunxu at yahoo dot com>
- To: xsl-list <xsl-list at lists dot mulberrytech dot com>
- Date: Sun, 20 Jan 2002 07:38:08 -0800 (PST)
- Subject: [xsl] using keys as cross-reference
- Reply-to: xsl-list at lists dot mulberrytech dot com
Hi,
I am interested to implement cross-reference using
keys (suggested by Jeni as well as documented in the
XSLT Programmer Reference 2nd Ed. on p.501-3).
My situation is I have more readable headers in
Excel (i.e. *Organization Unique ID)that needs to be
translated into DTD attribute names (i.e.
OrganizationCode). I intend to put the name-value
mapping in a separate XML, which I want to use keys to
retrieve the translation.
I see two ways to accomplish this:
1. translates all the headers at the beginning of the
stylesheet into global variables. This way, I do not
have to write user defined extensions. The drawback
to this I lose extensibility, it will be difficult
when I also wish to translate values other than the
headers.
2. user defined extension to translate between name
and value on demand.
Are there other more effective solutions?
Regarding solution #2 user defined extension, how to
pass the key into the extension since <xsl:key> has to
be top-level element? With example on XSLT Programmer
Reference 2nd Ed. on p.502,
<xsl:key name="biog" match="author" use="@name"/>
In my extension function, can I directly use:
key('biog', $name)?
Much thanks,
Xiaocun
__________________________________________________
Do You Yahoo!?
Send FREE video emails in Yahoo! Mail!
http://promo.yahoo.com/videomail/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list