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

Subject: Re: [xsl] Getting the name the input data document
From: Jingjun Long <longjingjun@xxxxxxxxx>
Date: Fri, 21 Aug 2009 16:19:38 +0800
base-uri is useful to locate graphics, xml and other resource
referenced in the XML.

Thanks Michael, your response is useful for me.

Jingjun


2009/8/21 Michael Kay <mike@xxxxxxxxxxxx>:
>>
>> 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.
>
> Regards,
>
> Michael Kay
> http://www.saxonica.com/
> http://twitter.com/michaelhkay

Current Thread