This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: XSLT V 1.1




> I don't understand what you're saying. Could you please 
> provide an XSL code or pseuodocode to explain why 
> I need something other than top-level URI ?

suppose the source file has

<mumble href="xxx.xml"/>

and I want the stylesheet to use document() to follow that link then
I need

<xsl:template match="mumble">
 <xsl:apply-templates select="document(@href,????)"/>
</xsl:template>

Currently ???? is . so I get the URI of the current mumble node as the
base URI with which to resolve the relative URI ref.

You haven't suggested any way so far in which to get this functionality
with your proposed replacement.

Except for little example files as posted to this list, in real
documents around here, the base URI of the mumble node is _almost never_
the base URI of the root of the input document. Chapters sections etc
almost always live in subdirectories of the directory containing the
root node.

If you were looking to change things, I think it would be simpler to use
a one-argument form of document() along with two functions, as follows

select="document(uri-resolve-with-base(@href,uri-of-node(.)))"

where uri-resolve-with-base() takes two strings and makes an absolute
URI (essentially by removing anything after the last / in the base,
concatenating that with the relative URI and then cleaning up ../ and ./
segments, or just returning the first argument if it is already absolute)

and uri-of-node() returns the URI of the first node in its node-set
argument.


David


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]