This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: further question on creating an id
- From: naha at ai dot mit dot edu
- To: xsl-list at lists dot mulberrytech dot com, 林 子芯 <minikittygo at hotmail dot com>
- Date: Wed, 06 Feb 2002 16:46:52 -0500 (EST)
- Subject: Re: [xsl] further question on creating an id
- References: <F159cTCi90gP8yJrNKB0001ef89@hotmail.com>
- Reply-to: xsl-list at lists dot mulberrytech dot com
Your example document isn't well-formed XML.
Quoting 林 子芯 <minikittygo@hotmail.com>:
> hi there, i was wondering anyone could help me out on this question...
> suppose i have such structure...
>
> <people>
> <male>
> <person>
> <name>
> <first_name>Alan</first_name>
> <last_name>Turing</last_name>
> </name>
> <profession>computer scientist</profession>
> <profession>mathematician</profession>
> <profession>cryptographer</profession>
> </person>
>
> <person>
> <name>
> <first_name>Richard</first_name>
> <middle_initial>M</middle_initial>
> <last_name>Feynman</last_name>
> </name>
> <profession>physicist</profession>
> <hobby>Playing the bongoes</hobby>
> </person>
**** missing a close tag for <male>
**** there was no open tag for <technic>
> </technic>
>
> <female>
> <person>
> <name>
> <first_name>Shelia</first_name>
> <middle_initial>M</middle_initial>
> <last_name>Feynman</last_name>
> </name>
> <profession>mathematican</profession>
> <hobby>Jogging</hobby>
> </person>
> ...
> </female>
> </people>
>
> my question is, i wish to transform it into a html format, is it
> possible
> to add an id to all the profession? will i be able to have the same id
> for
> identical profession? (e.g profession for mathematican will be the same
>
> regardless whether it is in the male element or female element)if no, is
>
> there a way to get round the problem?
Is there any reason why you can't use the name of the profession as the id?
You could use a key which maped the name of a profession to the result
of doing generate-id() on the first profession element with that content.
I don't have my copy of Mike Kay's book handy so I can't provide the right
code for you now. It should be easy enough to figure out though. Read
about the XSLT "key" element and the "key" function.
> furthermore, i seen Andrew provide a solution for Yan for selecting an
> element dynamically, however, i was wondering how would i achieve
> similiar
> result using xalan and xerces?
>
> many thanks
>
> Kit
>
> _________________________________________________________________
> 使用 MSN Messenger
> 與朋友在線上聊天:http://messenger.microsoft.com/tc。
>
>
> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
>
>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list