Vincent Lefevre
Usenet Archive
- Joined
- Aug 11, 2002
- Messages
- 60
- Reaction score
- 0
I would like to know if the base URI considered to resolve an unparsed entity defined by a relative URI should be the URI before or after its rewriting due to a possible catalog.
Let's take an example. Here's my XML file:
<?xml version="1.0"?>
<!DOCTYPE para
PUBLIC "-//Norman Walsh//DTD Website Full V2.4.0//EN"
"http://docbook.sourceforge.net/release/website/2.4.0/website-full.dtd" [ <!ENTITY % entities SYSTEM "http://www.vinc17.org/www.ent"> %entities; ]> <para><olink targetdocent="local.index.en">test</olink></para>
and my XSLT file:
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="olink"> <a href="{unparsed-entity-uri(@targetdocent)}"> <xsl:apply-templates/> </a> </xsl:template> </xsl:stylesheet>
http://www.vinc17.org/www.ent is a file in which I define unparsed entities that are relative to http://www.vinc17.org/. For instance:
<!ENTITY local.index.en SYSTEM "index.en.html" NDATA XML>
As I don't want to connect to http://www.vinc17.org/ to generate the URI, I use a catalog with the following entry:
<rewriteSystem systemIdStartString="http://www.vinc17.org/www.ent" rewritePrefix="file:///home/lefevre/wd/www-new/www.ent"/>
(in fact, http://www.vinc17.org/www.ent doesn't even exist in the reality, however the XSLT processor doesn't have to know that). But then, xsltproc generates the following file:
<?xml version="1.0"?>
<a href="file:///home/lefevre/wd/www-new/index.en.html">test</a>
instead of:
<?xml version="1.0"?>
<a href="http://www.vinc17.org/index.en.html">test</a>
Is that correct? I would have said that since the XSLT specifications don't define the notion of catalog, a catalog should be regarded only as a cacheing system (i.e. transparent for XML generation by XSLT); in this case, I should have got the version with http://www.vinc17.org/.
Otherwise, I would have been interested in a different version of the unparsed-entity-uri function that would have yielded a relative URI. If I define all the URIs and filenames with relative names, then xsltproc does generate a relative URI, but this URI is relative to the current directory and not the document defining the entity; therefore this is not acceptable.
Let's take an example. Here's my XML file:
<?xml version="1.0"?>
<!DOCTYPE para
PUBLIC "-//Norman Walsh//DTD Website Full V2.4.0//EN"
"http://docbook.sourceforge.net/release/website/2.4.0/website-full.dtd" [ <!ENTITY % entities SYSTEM "http://www.vinc17.org/www.ent"> %entities; ]> <para><olink targetdocent="local.index.en">test</olink></para>
and my XSLT file:
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="olink"> <a href="{unparsed-entity-uri(@targetdocent)}"> <xsl:apply-templates/> </a> </xsl:template> </xsl:stylesheet>
http://www.vinc17.org/www.ent is a file in which I define unparsed entities that are relative to http://www.vinc17.org/. For instance:
<!ENTITY local.index.en SYSTEM "index.en.html" NDATA XML>
As I don't want to connect to http://www.vinc17.org/ to generate the URI, I use a catalog with the following entry:
<rewriteSystem systemIdStartString="http://www.vinc17.org/www.ent" rewritePrefix="file:///home/lefevre/wd/www-new/www.ent"/>
(in fact, http://www.vinc17.org/www.ent doesn't even exist in the reality, however the XSLT processor doesn't have to know that). But then, xsltproc generates the following file:
<?xml version="1.0"?>
<a href="file:///home/lefevre/wd/www-new/index.en.html">test</a>
instead of:
<?xml version="1.0"?>
<a href="http://www.vinc17.org/index.en.html">test</a>
Is that correct? I would have said that since the XSLT specifications don't define the notion of catalog, a catalog should be regarded only as a cacheing system (i.e. transparent for XML generation by XSLT); in this case, I should have got the version with http://www.vinc17.org/.
Otherwise, I would have been interested in a different version of the unparsed-entity-uri function that would have yielded a relative URI. If I define all the URIs and filenames with relative names, then xsltproc does generate a relative URI, but this URI is relative to the current directory and not the document defining the entity; therefore this is not acceptable.