[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: MS XML DOM question...

Subject: RE: MS XML DOM question...
From: "Chris Bayes" <chris@xxxxxxxxxxx>
Date: Mon, 5 Nov 2001 22:45:15 -0000
selectsinglenode html
Frank,
Mike is right. Off the top of my head.
I am presuming you have your xml in a domdocument called xml

XSLT version
xsl.loadXML('<?xml version="1.0"?><xsl:stylesheet
xmlns:x="http://www.w3.org/1999/XSL/Transform" version="1.0"><x:template
match="node()"><x:copy><x:apply-templates select="*"
/></x:copy></x:template><x:template match="BODY"><Section Title="title">
... </Section></x:template></x:stylesheet>');
xml.transformNodeToObject(xsl,xml);

DOM version
var sxml = xml.createNode(NODE_ELEMENT, "Section");
sxml.appendChild(xml.createTextNode(" ... "));
sxml.setAttribute("Title", "title");sxml =
xml.selectSingleNode("/HTML").appendChild(sxml);
xml.selectSingleNode("/HTML").removeChild(xml.selectSingleNode("/HTML/BO
DY");

Ok it looks a little longer but if you remove the xslt preamble i.e.
<?xml version="1.0"?><xsl:stylesheet
xmlns:x="http://www.w3.org/1999/XSL/Transform" version="1.0"> then it
isn't. And the logic is much easier to understand.

Ciao Chris 

XML/XSL Portal
http://www.bayes.co.uk/xml


> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx 
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of 
> Casadome, Francisco Javier
> Sent: 05 November 2001 21:24
> To: 'xsl-list@xxxxxxxxxxxxxxxxxxxxxx'
> Subject: RE:  MS XML DOM question...
> 
> 
> I was expecting that answer :)
> Thanks anyway,
> Frank.
> 
> -----Original Message-----
> From: Michael Kay [mailto:michael.h.kay@xxxxxxxxxxxx] 
> Sent: lunes, 05 de noviembre de 2001 21:26
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: RE:  MS XML DOM question...
> 
> > I don't know if this is the right place to ask this 
> question but I'm 
> > desperate :( I need to rename a node and add it an attribute using 
> > DOM.
> 
> This is the right place to ask the question if you want 
> people to tell you that it would be easier to do it with XSLT.
> 
> Mike Kay
> 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 
> 


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.