You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Sh...@lotus.com on 2001/02/02 19:28:51 UTC
RE: Can't parse - base URL/URI
This should be in a FAQ for Xalan (we have plans someday to work on one...)
Just setSystemId(URLString) your inputs; only really needed when dealing
with streams/readers/etc. Remeber that systemId's need to be legal URL's,
like file:///path/file.txt, not just plain local paths to files. See the
RFC's for help on this.
Compare StreamSources that are constructed with Strings (being URL's):
Source xslSource1 = new StreamSource(filenameToURL( xslName));
Source xmlSource1 = new StreamSource(filenameToURL( xmlName));
Result result1 = new StreamResult("outfile.txt");
Templates templates1 = factory.newTemplates(xslSource1);
Transformer transformer1 = templates1.newTransformer();
transformer1.transform(xmlSource1, result1);
With any sources that are constructed otherwise, which need systemId set:
InputStream xslStream1 = new FileInputStream( xslName);
Source xslSource1 = new StreamSource(xslStream1);
xslSource1.setSystemId(filenameToURL( xslName));
InputStream xmlStream1 = new FileInputStream( xmlName);
Source xmlSource1 = new StreamSource(xmlStream1);
xmlSource1.setSystemId(filenameToURL( xmlName));
FileOutputStream fos1 = new
FileOutputStream(outNames.currentName());
Result result1 = new StreamResult(fos1);
Templates templates1 = factory.newTemplates(xslSource1);
Transformer transformer1 = templates1.newTransformer();
transformer1.transform(xmlSource1, result1);
For more examples (tho not pretty) see
xml-xalan\test\tests\java\src\org\apache\qetest\trax\SystemIdImpInclTest.java
- Shane
> i was unable to find past references to answer this question...how/where
do
> i set a base uri?
RE: Can't parse - base URL/URI
Posted by chris markiewicz <cm...@commnav.com>.
great. works for me. one final question - is it legit to set the system id
to a directory and not a file...in my case,
"http://cmarkiewicz.mars.dev.commnav.com", or should it point to an actual
file?
thanks for your help!
chris
-----Original Message-----
From: Shane_Curcuru@lotus.com [mailto:Shane_Curcuru@lotus.com]
Sent: Friday, February 02, 2001 1:29 PM
To: xalan-dev@xml.apache.org
Subject: RE: Can't parse <xsl:include href="Variables.xsl"/> - base
URL/URI
This should be in a FAQ for Xalan (we have plans someday to work on one...)
Just setSystemId(URLString) your inputs; only really needed when dealing
with streams/readers/etc. Remeber that systemId's need to be legal URL's,
like file:///path/file.txt, not just plain local paths to files. See the
RFC's for help on this.
Compare StreamSources that are constructed with Strings (being URL's):
Source xslSource1 = new StreamSource(filenameToURL( xslName));
Source xmlSource1 = new StreamSource(filenameToURL( xmlName));
Result result1 = new StreamResult("outfile.txt");
Templates templates1 = factory.newTemplates(xslSource1);
Transformer transformer1 = templates1.newTransformer();
transformer1.transform(xmlSource1, result1);
With any sources that are constructed otherwise, which need systemId set:
InputStream xslStream1 = new FileInputStream( xslName);
Source xslSource1 = new StreamSource(xslStream1);
xslSource1.setSystemId(filenameToURL( xslName));
InputStream xmlStream1 = new FileInputStream( xmlName);
Source xmlSource1 = new StreamSource(xmlStream1);
xmlSource1.setSystemId(filenameToURL( xmlName));
FileOutputStream fos1 = new
FileOutputStream(outNames.currentName());
Result result1 = new StreamResult(fos1);
Templates templates1 = factory.newTemplates(xslSource1);
Transformer transformer1 = templates1.newTransformer();
transformer1.transform(xmlSource1, result1);
For more examples (tho not pretty) see
xml-xalan\test\tests\java\src\org\apache\qetest\trax\SystemIdImpInclTest.jav
a
- Shane
> i was unable to find past references to answer this question...how/where
do
> i set a base uri?