Re: use of xsl:key in cross-referencing
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
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