RE: [xsl] Getting the name the input data document

Subject: RE: [xsl] Getting the name the input data document
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Fri, 21 Aug 2009 09:01:06 +0100
> I tried to use base-uri to get XML path and static-base-uri 
> to get XSL path. This works find when I run the 
> transformation from XML file and XSL file locate on the hard disk.
> When I run the transformation against XML which generate on 
> the fly by a program. The base-uri function return empty. 
> From the implementation point of view there is no base-uri 
> for a XML which generated on the fly.

More precisely, when you generate XML it's your responsibility to define a
base URI for it. If you don't define a base URI for it, then relative URIs
contained within the document cannot be resolved. 

You can define a base URI by creating an xml:base attribute within the
document, or from the API: for example, if the document is generated as the
result of an XSLT transformation controlled using JAXP, you can use
setSystemId() on the Result object passed to the transform() method.


Michael Kay 

Current Thread