Hi Lea
The content of a Branch (a Document or Element) is a List that you can
modify. So you can do things like
Map arguments = new HashMap();
args.put( "type", "text/xsl" );
args.put( "href", "blah.xsl" );
DocumentFactory factory = new DocumentFactory();
ProcessingInstruction pi
= factory.createProcessingInstruction( "xml:stylesheet", args );
Document doc = ...;
List content = doc.content();
// modify the list however we wish
content.add( 0, pi );
James
----- Original Message -----
From: "Lea Allison" <[EMAIL PROTECTED]>
To: "'James Strachan'" <[EMAIL PROTECTED]>
Sent: Thursday, April 04, 2002 10:18 AM
Subject: RE: [dom4j-user] Adding a stylesheet element
> Hi
>
> thanks, it adds it, but it adds it as the last element on the page. How
can
> I get it at the top with the first XML processing instruction?
>
> Thanks
>
> Lea
>
> -----Original Message-----
> From: James Strachan [mailto:[EMAIL PROTECTED]]
> Sent: Thursday 04 April 2002 00:55
> To: Lea Allison; [EMAIL PROTECTED]
> Subject: Re: [dom4j-user] Adding a stylesheet element
>
>
> The stylesheet line you mention is a processing instruction in XML terms.
> You can do this in dom4j as follows...
>
> Map arguments = new HashMap();
> args.put( "type", "text/xsl" );
> args.put( "href", "blah.xsl" );
> Document doc = ...;
> doc.addProcessingInstruction( "xml:stylesheet", args );
>
> James
> ----- Original Message -----
> From: "Lea Allison" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Wednesday, April 03, 2002 9:19 AM
> Subject: [dom4j-user] Adding a stylesheet element
>
>
> > Hi
> >
> > Does anyone know how I can add the stylesheet processing element to an
XML
> > document?
> >
> > eg: I have an XML doc, I want to load it in, add the stylesheet line and
> > then save...
> > <?xml version="1.0" encoding="ISO-8859-1" ?>
> > .. add here <?xml:stylesheet type="text/xsl" href="blah.xsl" ?>
> > <DOCUMENT>
> > <H>Hello World</H>
> > </DOCUMENT>
> >
> >
> > Thanks
> >
> > Lea
> >
> > _______________________________________________
> > dom4j-user mailing list
> > [EMAIL PROTECTED]
> > https://lists.sourceforge.net/lists/listinfo/dom4j-user
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
_______________________________________________
dom4j-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dom4j-user