xsl-list
[Top] [All Lists]

Re: [xsl] accessing the input XML's doctype

2008-07-16 14:45:28


But my understanding is that the parser reads in the XML, resolves any
default attribute values, and then passes the document tree to the XSLT
processor.  The XSLT processor itself doesn't know or care about the
doctype information.  Is this correct?

essentially, yes.

what I'd do (if you have write access to local copies of the dtds) is to
ammend them to default a couple of attributes on to th etop level
element which contain the PUBLIC and SYSTEM identifiers.

then if you have

<!DOCTYPE foo PUBLIC "a//b//b" "dtd/this/that'dtd">
<foo>

If you've modified your local copy of the dtd, the paraser can report

<foo PUBLIC="a//b//b" SYSTEM="dtd/this/that'dtd">
...

and then picking up the information from xsl is easy.

You then want to use the same ids in output. unfortunately you can't use
dynamically calculated values with doctype-public on xsl:output, but you
can on xsl:result-document, so you just need

<xsl:template match="/">
<xsl:result-document href=".." doctype-public="{*/@PUBLIC)"
doctype-system="{*/@SYSTEM}"/>

If editing the dtd is not an otion for some reason other things can
produce the same effect as defaulting the attribtes yu could (I assume,
not done it personally) interpose a sax filter between the original
source and the xslt engine that just passed everything through except
defaulted these attributes.

David

________________________________________________________________________
The Numerical Algorithms Group Ltd is a company registered in England
and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.

This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs. 
________________________________________________________________________

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--