[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: MS XML DOM question...
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|