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

Re: XUpdate

Subject: Re: XUpdate
From: Mike Brown <mike@xxxxxxxx>
Date: Tue, 28 Jan 2003 00:16:34 -0700 (MST)
xupdate processor
S Woodside wrote:
> I'm considering XUpdate instead of XSLT for use to add elements to an 
> existing XML instance document. I'll have an XPath and the element 
> content as params, and the instance as input. I think XSLT would work 
> OK, but it seems as though XUpdate offers a lot of convenience features 
> I would have to write myself in XSLT to do the same thing.
> 
> However, I noticed that XUpdate had active development and chatter on 
> the mailing list until early 2002 and then it died away. Is this a dead 
> technology? Should I roll my own in XSLT instead?

We implemented XUpdate in 4Suite [1]. It works great, and if you're also using
4Suite's repository features to write a web application in XSLT, we have an
XSLT extension element that invokes an XUpdate processor on that element's
content, to modify documents in the repository. Sample code, based on an 
example in the XUpdate spec, is below.


from Ft.Xml import XUpdate, InputSource

xml_src = """<?xml version="1.0"?>
<addresses version="1.0">
  <address id="1">
    <fullname>Andreas Laux</fullname>
    <born day='1' month='12' year='1978'/>
    <town>Leipzig</town>
    <country>Germany</country>
  </address>
</addresses>"""

xup_src = """<?xml version="1.0"?>
<xupdate:modifications
  version="1.0"
  xmlns:xupdate="http://www.xmldb.org/xupdate">
  <xupdate:insert-after select="/addresses/address[1]" xml:space="preserve">
  <xupdate:element name="address"><xupdate:attribute name="id">2</xupdate:attribute>
    <fullname>Lars Martin</fullname>
    <born day='2' month='12' year='1974'/>
    <town>Leizig</town>
    <country>Germany</country>
  </xupdate:element></xupdate:insert-after>
</xupdate:modifications>"""

xml_isrc = InputSource.DefaultFactory.fromString(xml_src, 'http://foo/dummy.xml')
xup_isrc = InputSource.DefaultFactory.fromString(xup_src, 'http://foo/dummy2.xml')
processor = XUpdate.Processor()
xureader = XUpdate.Reader()
xml_dom = xureader.fromSrc(xml_isrc)
xup_dom = xureader.fromSrc(xup_isrc)
xml_dom = processor.execute(xml_dom, xup_dom)

from Ft.Xml.Lib.Print import Print
Print(xml_dom)


Result of running the above:

<?xml version="1.0" encoding="UTF-8"?>
<addresses version="1.0">
  <address id="1">
    <fullname>Andreas Laux</fullname>
    <born month="12" day="1" year="1978"/>
    <town>Leipzig</town>   
    <country>Germany</country>
  </address>
  <address id="2">
    <fullname>Lars Martin</fullname>
    <born month="12" day="2" year="1974"/>
    <town>Leizig</town>
    <country>Germany</country>
  </address>
</addresses>

Mike

-- 
  Mike J. Brown   |  http://skew.org/~mike/resume/
  Denver, CO, USA |  http://skew.org/xml/

  [1] http://4suite.org/ ... preferably, use latest code from CVS

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


Current Thread
  • XUpdate
    • S Woodside - Mon, 27 Jan 2003 18:56:03 -0500 (EST)
      • Joerg Heinicke - Mon, 27 Jan 2003 20:37:02 -0500 (EST)
        • S Woodside - Mon, 27 Jan 2003 23:50:23 -0500 (EST)
      • Mike Brown - Tue, 28 Jan 2003 02:15:06 -0500 (EST) <=

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.