Altova Mailing List Archives


Re: [xsl] Function id() does not work XSLT - XML - XML-Schema

From: "G. Ken Holman" <gkholman@-------------------->
To:
Date: 12/19/2002 9:51:00 PM
At 2002-12-20 08:18 +0100, robhan@xxxxxx wrote:
 Question: Why does the Function id() not work??

Because you have not instructed the processor which attributes are of type ID.



Attribute refDim is of type "IDREFS". Attribute id of
 Dimension
 is of type "ID"

You say that in your schema, but XSLT 1.0 predates W3C Schema.



 For me it looks like, that the xsl transformation does not know the
 schema.
 Correct? If yes, why?

Because XSLT 1.0 was released in November 1999 and W3C Schema was released 
in May 2001.  XSLT 1.0 can, therefore, not have known anything about W3C 
Schema.



At the beginning of your XML file add an appropriate declaration of the 
attributes you need recognized:



   <!DOCTYPE SpeedTest
   [
   <!ATTLIST Dimension id ID #REQUIRED>
   ]>

You can make them either #REQUIRED or #IMPLIED and you just have one line 
per element type declaring which attribute is of type ID.



Without such a declaration there is no way for the XSLT processor to know 
which attributes are of type ID.  The name is irrelevant and there are no 
assumptions on attributes named ID, only on those declared as type ID.



Note that since there are no element content models declared, there is no 
validation that goes on ... you are just instructing XML processors which 
attributes are of type ID.



An alternative would be to use keys instead of ID, but there is no 
tokenized access to a list of key values so you cannot readily mimic 
IDREFS.  If you are only using IDREF then you don't have to change your XML 
and you can just have your stylesheet worry about it.



I hope this helps.



................... Ken




--
Upcoming hands-on in-depth XSLT/XPath and/or XSL-FO:
-                             North America:  Feb 3 - Feb 7,2003

G. Ken Holman               mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Crane Softwrights Ltd.        http://www.CraneSoftwrights.com/s/
Box 266, Kars, Ontario CANADA K0A-2E0  +1(613)489-0999 (F:-0995)
ISBN 0-13-065196-6                     Definitive XSLT and XPath
ISBN 0-13-140374-5                             Definitive XSL-FO
ISBN 1-894049-08-X Practical Transformation Using XSLT and XPath
ISBN 1-894049-10-1             Practical Formatting Using XSL-FO
Next conference training:                          2003-03-03,06


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

Disclaimer

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.