[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Call for feedback : Update extensions
> The basic update statement I suggest (to update the source DOM) is : > > <xslql:update > match = pattern > select = expression> > <!-- Content: template --> > </xslql:template> > Match=pattern suggests you have to search the whole document looking for the nodes that match, which is pretty inefficient. SAXON only allows update of attributes on the current (element) node, and uses the syntax <saxon:set-attribute name="attname" [select="expr"]>[value]</saxon:set-attribute> If you want to do update multiple nodes, or update a node that is not current, you use xsl:for-each, e.g <xsl:for-each select="//item[not(@price)]"> <saxon:set-attribute name="price" select="100.00"/> </xsl:for-each> It would be easy to extend this syntax to modify the value of a text node; other updates such as adding or deleting nodes would require more careful thought, not only as regards the syntax, but also as regards the side-effects, e.g. on the value of variables that hold a node-set. Generally speaking, updating the source tree rather violates the spirit of the language. The main reason I implemented saxon:set-attribute was part of the attempt to create a version of XSL that worked without building the full tree in memory, though it can also be very handy for expanding defaults e.g. before doing totalling or sorting. I have mixed feelings on whether it was a good idea. Mike Kay 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
|