xsl-list
[Top] [All Lists]

Re: [xsl] Generating an internal subset?

2010-06-30 16:06:39
On 30/06/2010 19:51, dvint(_at_)dvint(_dot_)com wrote:
I need to create the following in the XML output:

<!DOCTYPE dmodule [
        <!ENTITY % ISOEntities PUBLIC "ISO 8879-1986//ENTITIES ISO Character
Entities 20030531//EN//XML"
"http://www.s1000d.org/S1000D_3-0/ent/xml/ISOEntities";>
        %ISOEntities;
]>


Not that relevant to your qn but the currently supported version of those entities (after ISO handed over maintenance of them to W3C/me) are linked from

http://www.w3.org/TR/2010/REC-xml-entity-names-20100401/


The solution I found was this:

<xsl:text disable-output-escaping="yes">
        <![CDATA[
<!DOCTYPE dmodule [
        <!ENTITY % ISOEntities PUBLIC "ISO 8879-1986//ENTITIES ISO Character
Entities 20030531//EN//XML"
"http://www.s1000d.org/S1000D_3-0/ent/xml/ISOEntities";>
        %ISOEntities;
]>
        ]]>
</xsl:text>

Just wondering if there is a better way to do this.

That's best you can do if you really need an internal subset.
(using pure xslt, saxon has an extension to do this I believe)
Better perhaps is use
<!DOCTYPE dmodule SYSTEM "local.dtd">

which you can generate using <xsl:output doctype-system="local.dtd"/>

then you just haave to write local.dtd to look like (in total)

<!ENTITY % ISOEntities PUBLIC "ISO 8879-1986//ENTITIES ISO Character Entities 20030531//EN//XML"
 "http://www.s1000d.org/S1000D_3-0/ent/xml/ISOEntities";>
        %ISOEntities;




Note though that if you do this (or what you suggested) any xml parser using the file that you generate will (by default) need a network connection to that server (or to the w3c server if you use the current versions)



Also I had some interesting results while using StylusStudio. without this
statement things would run in a flash, with it, it would take like a
minute to run. Seems like it was trying to go retrieve this external
entity. When running directly with Saxon I saw no difference in processing
time.

Perhaps it is validating the generated result file?


..dan



If the file is being generated by XSLT, unless you go to a lot of trouble with disable-output-escaping, it will nothave any entity references in it, so you should not need to define any entities, so why do you need to refer to these entity definitions?

David]

--~------------------------------------------------------------------
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>
--~--

<Prev in Thread] Current Thread [Next in Thread>