RE: [xsl] Relative URI Question

Subject: RE: [xsl] Relative URI Question
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Thu, 7 Jun 2007 09:32:47 +0100
Try

context.getReceiver().getSystemId()

This should give the right answer in most circumstances, but not if for
example you are currently writing to a variable or to an <xsl:document> or
<xsl:message> (a so called "temporary destination"). There's an internal
flag in the context object that indicates whether the current destination is
temporary, but it's private, unfortunately.

Michael Kay
http://www.saxonica.com/ 

> -----Original Message-----
> From: jason heddings [mailto:rocket@xxxxxxxxxxx] 
> Sent: 06 June 2007 23:55
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: RE: [xsl] Relative URI Question
> 
> That is working fine, except when it is during a 
> <xsl:result-document> when it still shows original output 
> uri, not the result uri.
> 
> > -------- Original Message --------
> > Subject: RE: [xsl] Relative URI Question
> > From: "Michael Kay" <mike@xxxxxxxxxxxx>
> > Date: Wed, June 06, 2007 3:40 pm
> > To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
> > 
> > If you declare the XPathContext object as a parameter to your 
> > extension function, the base output URI is available as
> > 
> > context.getController().getBaseOutputURI()
> > 
> > Michael Kay
> > http://www.saxonica.com/
> > 
> > > -----Original Message-----
> > > From: jason heddings [mailto:rocket@xxxxxxxxxxx]
> > > Sent: 06 June 2007 23:17
> > > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> > > Subject: RE: [xsl] Relative URI Question
> > > 
> > > I've written a (Saxon) Java extension function to compute the 
> > > relative path between two files.  It's a bit lengthy, but 
> it works 
> > > well.  The only problem is, I'm not sure how to access 
> the current 
> > > output document path from within my function.  I was 
> hoping for an 
> > > XSLT example, or at least some XSL function that provided the 
> > > current output path.
> > > 
> > > 
> > > > -------- Original Message --------
> > > > Subject: RE: [xsl] Relative URI Question
> > > > From: "Michael Kay" <mike@xxxxxxxxxxxx>
> > > > Date: Wed, June 06, 2007 3:10 pm
> > > > To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
> > > > 
> > > > resolve-uri() turns a relative URI into an absolute 
> URI. There's 
> > > > no function to do the reverse. In fact, I'm not aware of any
> > > algorithm to
> > > > do the reverse.
> > > > 
> > > > Michael Kay
> > > > http://www.saxonica.com/
> > > > 
> > > > > -----Original Message-----
> > > > > From: jason heddings [mailto:rocket@xxxxxxxxxxx]
> > > > > Sent: 06 June 2007 23:04
> > > > > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> > > > > Subject: [xsl] Relative URI Question
> > > > > 
> > > > > Hello-
> > > > > 
> > > > > I'm having a bit of trouble with the resolve-uri() function.  
> > > > > I would like to generate a relative path from one file to
> > > another,
> > > > > but
> > > > > resolve-uri() is leaving my full file path.  I'm 
> calling it as:
> > > > > resolve-uri($path) where $path is the full path to the file, 
> > > > > including file://.  What I'm hoping for is a path relative to 
> > > > > the current output document (to make it easier to move the
> > > transformed
> > > > > docs).
> > > > > 
> > > > > Thanks,
> > > > > --jah

Current Thread