[xsl] using xslt1 templates like dom methods, data overriding considerations

Subject: [xsl] using xslt1 templates like dom methods, data overriding considerations
From: "Luis A Ortiz" <luis@xxxxxxxxxxxxxxxx>
Date: Thu, 25 Jan 2007 14:45:30 -0500
Hi List,  I have an app I'm working on that contains a lot of xml formatted
data.  I am building in functionality so that this default content can be
overridden without changing the default xml by writing the changes into a
separate xml file.   

This [XSLT template] is simple enough for node deletion (omission) or
updates because my override xml tags are explicit about this <removenode
nodeid="123"/> and <updatenode nodeid="124">updated content</updatenode> 

but to include new nodes, and control where they are inserted, I want to use
something like <insertnode nodeid="125" parentnodeid="123"
position="last">new content</insertnode> or <insertnode nodeid="125"
parentnodeid="123" position="first">new content</insertnode> or <insertnode
nodeid="125" parentnodeid="123" insertbeforenodeid="456">new
content</insertnode> <insertnode nodeid="125" parentnodeid="123"
insertafternodeid="456">new content</insertnode>

This is basically like the regular DOM methods, appendChild(),
insertBefore() but I'm trying to do these with XSLT.  The nodes that I want
to insert relative to (after, before) may be being modified with update or
remove templates.  

So my multi-part question is: can I do this in XSLT 1, MS .Net 1.1 (.net2
only if necessary) in the one transformation, or should this be a multiple
transformations, or perhaps its better to do the insertions with DOM outside
of XSLT (in aspx .net file, written in C#)?  What is the best-practices
approach to this type of design in general? I have tried searching for info
on this pattern but haven't much discussion so far.

I do have complete samples of what I have worked out thus far if it's
useful:
Source xml http://ndimensional.org/code/Lesson16-topic-4-wgeneratedids.xml
Override xml
http://ndimensional.org/code/Lesson16-topic-4-wgeneratedids-overrides-sepera
teschema.xml
XSL so far http://ndimensional.org/code/copysmart.xsl
My current output http://ndimensional.org/code/part1output.xml

Not sure if this is approp to ask here, since it affects many of my
projects, I was wondering if anyone knows/wants to conjecture if/when MS
will decide to support XSLT 2 in their server product? I read they had
decided not to in favor of XQuery (2?) but were possibly revisiting that
decision. I do realize that there exist excellent independently created
processors (thanks Dr Kay) but often (so far) I've had to stick to MS 2003
out-of-the-box capabilities.

Congrats and thank you to all the folks that worked so hard at getting us
the 2.0 spec to Recommendation level!
Best Regards,
Luis Ortiz
http://ndimensional.org

Current Thread