Re: [xsl] use of xsl:key in cross-referencing

Subject: Re: [xsl] use of xsl:key in cross-referencing
From: Xiaocun Xu <xiaocunxu@xxxxxxxxx>
Date: Wed, 19 Mar 2003 16:45:34 -0800 (PST)
Hi, Peter:

Thanks for the suggestion of using ID/IDREF. 
Unfortunely the source XML is generated via a generic
reader/writer that reads each cell from a Excel
spradsheet and writes to this XML, it does not have
any business logic (which is one of the design goal)
and therefore can not implement ID/IDREF easily.

Xiaocun

> Yes, XML has a built-in cross-reference mechanism
> which uses special 
> attribute types called ID and IDREF. If you modify
> your DTD:
> 
> <!ELEMENT cell (#PCDATA)>
> <!ATTLIST cell column CDATA #REQUIRED
>                 questionnaire ID #IMPLIED
>                 question IDREF #IMPLIED>
> 
> Now you can say:
> 
> <row row="16">
> 	<cell column="1">References Name</cell>
> 	<cell column="2"
> questionnaire="ABC123">References</cell>
> 	<cell column="3">References Description</cell>
> </row>
> ...<rows in between skipped for brevity>...
> <row row="28">
> 	<cell column="1"
> question="ABC123">References</cell>
> 	<cell column="2">text of Question 8<cell>
> </row>
> <row row="29">
> 	<cell column="1"
> question="ABC123">References</cell>
> 	<cell column="2">text of Question 9</cell>
> </row>
> 
> The ID/IDREF mechanism is one-to-many, so if I have
> understood you
> right, this is what you want. The advantage is that
> ID/IDREF checking
> is built into validating parsers, so a validation
> will immediately
> pick up on any IDREF attribute trying to reference a
> non-existent ID
> value (but it's OK to have an ID value which never
> gets referenced).
> The only restriction is that ID/IDREF values must be
> Names (they must
> begin with a letter and may not contain spaces).
> 
> ///Peter
> 
> 
> 
>  XSL-List info and archive: 
> http://www.mulberrytech.com/xsl/xsl-list
> 


__________________________________________________
Do you Yahoo!?
Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!
http://platinum.yahoo.com

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread