|
Subject: RE: [xsl] Where is my document? local source path discovery (was XSLT 2 Functions for URL Manipulation (was Rewriting href)) From: "Marroc" <marrocdanderfluff@xxxxxxxxxxx> Date: Thu, 3 Jul 2008 10:38:39 +0100 |
Thanks Eliot. I'll give that a try now. I have been passing the path into
Saxon as a parameter:
java net.sf.saxon.Transform -s:""${input-file}""
-xsl:""C:/DITAwork/driver/xsl/FixURLv2.xsl"" opt_i=""${input-file}""
opt_o=""${output-file}""
but the source application passes a path that is corrupted by MS-DOS
'contractions', as in C:\PROGRA~1\..., so document-uri() is a much better
solution.
Thanks again,
Richard
-----Original Message-----
From: Eliot Kimber
Sent: 29 June 2008 18:01
To: xsl-list
Subject: Re: [xsl] Where is my document? local source path discovery (was
XSLT 2 Functions for URL Manipulation (was Rewriting href))
On 6/28/08 3:21 PM, "Marroc" <marrocdanderfluff@xxxxxxxxxxx> wrote:
> Wow Eliot - that is really useful, thanks. It took me a few minutes to
> read and understand but now I have, it has certainly saved me a great
> deal of time. Thanks very much.
>
> The missing piece of the puzzle then is to discover the local source
> path from within the source document while it is being processed. Once
> I have that, I'm home and dry! Does anyone have further ideas?
In XSLT 2 you can use document-uri() to get the URI of the current document,
so:
<xsl:template match="/">
<xsl:variable name="inputUrl" select="document-uri(.)" as="xs:string"/
</xsl:template>
In situations where the use of xml:base may have changed the base URI to
which a given relative path should resolve, you can use base-uri() rather
than document-uri(). For example, resolving references specified in incoming
attributes.
Cheers,
Eliot
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] <Übelkeit/> - ASCIIf, Michael Ludwig | Thread | [xsl] [ANN] Saxon 9.1 is available, Michael Kay |
| RE: [xsl] checking sequence inside , Michael Kay | Date | Re: [xsl] Validation XSLT using XSL, Michael Ludwig |
| Month |