[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] interpreting the DTD


Subject: Re: [xsl] interpreting the DTD
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Tue, 16 Jan 2001 11:20:59 +0000

Hi Klaus,

> It was impossible for me to access the contents of the referenced
> DTD in a XML - Doc with MSXML 1.0

I think that's still the case, even through navigating the DOM,
although it seems you can get (XDR) schema definitions with relative
ease.

Anyway, you can't do it with XSLT 1.0 - there's no XPath access to the
DTD.  There are two possible workarounds.

The first will only work if all the possibly options are covered in
your document.  If they were, you could find the unique values for the
attribute in the document by defining a key:

<xsl:key name="attr-values" match="NODE" use="@ATTR" />

and then iterating over the NODEs that are first in the list returned
by the key for that particular @ATTR value:

  <SELECT ...>
     <xsl:for-each
         select="//NODE[count(.|key('attr-values', @ATTR)[1]) = 1]">
       <INPUT TYPE="option" VALUE="{@ATTR}" ... />
     </xsl:for-each>
  </SELECT>

The other thing that you could do is define a schema that holds
information about the options rather than a DTD.  Since the schema is
XML, you can access it from within the XSLT using the document()
function, and then gather the relevant values from it in the normal
way.
  
I hope that helps,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/



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



Current Thread
Keywords