[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
Pramodh Peddi wrote:
J.Pietschmann
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Re: [xsl] Passing external URL for DTD reference
Subject: Re: [xsl] Passing external URL for DTD reference From: "J.Pietschmann" <j3322ptm@xxxxxxxx> Date: Tue, 18 Nov 2003 20:41:20 +0100 |
Pramodh Peddi wrote:
Probably yes.<!DOCTYPE EXAMPLE_DTD SYSTEM "xxx.dtd"> is there in the source xml. And xxx.dtd is at http://myserver.com/xsl/xxx.dtd (the file name in the url can be different - it can be named as yyy.dtd!). Can I know how to make the transformer look at this url?
I was passing in this URL to the StreamSource constructor - like new StreamSource(new StringReader(stylesheetStream),this.dtdURL)
This sets the URL for the stylesheet. You don't want to do this, looking up relative hrefs to imported style sheets will be botched.
Can we achieve this in any other way? I was trying to use EntityResolver
This would be correct. You have to create a parser explicitely use it in a SAX source to take effect.
public class MyResolver implements EntityResolver { public InputSource resolveEntity (String publicId, String systemId) { if (systemId.equals("xxx.dtd")) { // return a special input source MyReader reader = new MyReader(); return new InputSource(http://myserver.com/xsl/xxx.dtd); } else { // use the default behaviour return null; } } }
Here we don't know that the file name would be "xxx.dtd". Can we say return new InputSource(http://myserver.com/xsl/xxx.dtd); no matter what the xxx.dtd in the xml source is?
Yes. However, the entity resolver will be invoked for every entity, and some processors will it also invoke for the main input source. Therefore, the default should be return new InputSource(systemId); instead of returning null.
J.Pietschmann
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Passing external URL for DTD , Pramodh Peddi | Thread | RE: RE: [xsl] XPATH, poppe chris |
Re: [xsl] keep-together and FOP, J.Pietschmann | Date | RE: [xsl] Introducing a comma., cknell |
Month |
Keywords