RE: [xsl] XML 2 XML using XSL,DTD XALAN - JAVA

Subject: RE: [xsl] XML 2 XML using XSL,DTD XALAN - JAVA
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Thu, 25 Nov 2004 17:32:28 -0000
As I said before, xsl:output defines what happens when the result document
is serialized, and you are not doing any serialization, so it should be
ignored.

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


> -----Original Message-----
> From: contest.vix [mailto:contest.vix@xxxxxxxxxx]
> Sent: 25 November 2004 16:40
> To: xsl-list
> Subject: RE: [xsl] XML 2 XML using XSL,DTD XALAN - JAVA
>
> Hi,
> thanks for the tip.
> I'm using Jaxp, with Xalan 2.6.0, and the transformation
> result is stored in a DOMResult object(I tryed to obtain de
> DocType like this: ((Document)
> result.getNode()).getDoctype(), it returns null even with the
> output property of the XSL indicating the correct location of
> the DTD file, besides it even keep the XSL encoding). Do you
> have any ideia of what is going on?I don't know why the
> result Dom tree doesn't have the DTD and encoding desclared
> in the XSL file...
>
> So, If I use XSL 1.0,Will I have to parse the result DOM tree again?
>
> The code that I use to transform is:
> -------begin code
> 	public Document Transform(Document DOM, String
> XSlFileName) throws Exception{
> 		TransformerFactory transformerFactory = null;
> 		Transformer transformer = null;
> 		DOMResult result = null;
> 		StreamSource oLocFonteAqruivoXsl = new
> StreamSource(new FileInputStream(XSlFileName));
>
> 		transformerFactory = TransformerFactory.newInstance();
> 		result = new DOMResult();
>
> 		transformer =
> transformerFactory.newTransformer(new StreamSource(new
> FileInputStream(XSlFileName)));
> 		transformer.transform(new DOMSource(DOM), result);
>
> 		return ((Document) result.getNode());
> 	}
> --------end code
>
> thanks a lot,
> Roger.
>
> >
> > > Hi,
> > > thanks for the tip.
> > > The only way to validade the result DOM tree is to parse it
> > > again? The XSL that I'm using has the output property below:
> > >
> > > doctype-system="../DTD/MyDTD.dtd"/>
> > >
> > > Even with this, the result DOM tree doesn't have a DocType
> > > with it. Does anyone knows why? I tryed to setup the DocType
> > > by code:
> > >
> Transformer.setOutputProperty(OutputKeys.DOCTYPE_SYSTEM,"MyDTD.dtd");
> > >
> > > Even with this, the resulting DOM tree doesn't have a
> DocType wiht it.
> >
> >
> > You will need give some more information:
> >
> > What processor are you using?
> >
> > How are you creating the 'result DOM' - ie a DOMResult?
> >
> > How are you viewing the result to decide that it doesn't contain the
> > doctype?
> >
> > Ultimately the answer is 'yes' that the only XSLT 1.0 way
> to validate
> > the result is to parse it again. With 2.0 and a schema
> aware processor
> > (Saxon 8.x) you should be able to provide a result schema
> and Saxon will
> > flag up (halt or warn... not sure?) at transform time any non-valid
> > output.
> >
> > cheers
> > andrew
> >
>
> ______________________________________________________________
> ____________
> Acabe com aquelas janelinhas que pulam na sua tela.
> AntiPop-up UOL - I gratis!
> http://antipopup.uol.com.br/

Current Thread