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

Re: Partial update of server side XML documents

  • From: Manos Batsis <manos_lists@g...>
  • To: Farrukh Najmi <farrukh@w...>, XML Developers List <xml-dev@l...>
  • Date: Wed, 24 Sep 2008 19:42:06 +0300

Re:  Partial update of server side XML documents
Farrukh Najmi wrote:
> Another option might be to use simpler XPath/XSLT expressions to do the 
> same.
> Does any one have any experience or advice on how best to do this.

A proper way to do this would be an XML store and xquery or whatnot. 
However, most project budgets do not include that and seek such 
solutions for a very small subset of what the project actually does.

Couple of years ago i did this two ways for a server side java app. In 
the first approach, the request body was always an 
identity_transform_based XSLT document. An identity transform is one 
whose transformation result tree is the same as the input tree.

So, besides the identity template, that XSLT had other templates as 
desired. For example, suppose you only wanted to change the first 
heading of a document you could just use two templates:

<xsl:template match="@*|node()">
     <xsl:apply-templates select="@*|node()"/>

<xsl:template match="//heading[1]">
    <xsl:text> added text </xsl:text>

In the second approach, i was sending two things with each request: an 
HTTP param containing an XPath expression and a request body with the 
XML to replace the node matched by the XPath expression.

Both where sort of quick and dirty solutions but worked. In the first 
approach, the downside was that you had to take some care with the 
templates to avoid changing the wrong nodes. In the second approach you 
had somewhat limited capabilities as you essentially just replaced a 
node or fragment in the target document.

I intended to add a third hybrid approach where an XPath expression 
would be used to extract a fragment from the target document and an XSLT 
would be used to transform that before putting it back but the actual 
need never came up.

All document changes were versioned ;-)

Hope this helps.



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


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.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.

Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

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.