Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Merging 2 xsl docs

Status
Not open for further replies.

acsooley

Programmer
Nov 13, 2002
32
0
0
CA
Is their a way in JSP to merger 2 xsl files together before you that format the merged xsl with xml to display the result?
 
See here:
or
On how to use DOM with JSP (again, I don't use JSP...)

Then use it, as I mentioned in the other thread (thread426-1073337) to either import/include or merge the XSLs...

The standard DOM functions you need to work with are...
selectSingleNode(XpathPattern)
appendChild(Node)
cloneNode(True)
createElement(tagname)


You typically use like this...
Load File:
Code:
var xslDom1;
xslDom1 = new ActiveXObject("Microsoft.XMLDOM");
xslDom1.load("SomeXSL.xsl");

Create Element: (creates <xsl:include href="NEW-URL/text.xsl" />)
Code:
var Elem1;
Elem1 = xslDom1.createElement('xsl:include');
Elem1.attributes.setNamedItem('href').text = 'NEW-URL/text.xsl';

Get Existing Element: (finds <xsl:template name="temp">...</xsl:template>)
Code:
var Elem2;
Elem2 = xslDom1.selectSingleNode('//xsl:template[@name == "temp"').cloneNode(true);

Append Element To xslDom2: (xslDom2 created same way as xslDom1)
Code:
xslDom2.DocumentElement.appendChild(Elem1);
xslDom2.DocumentElement.appendChild(Elem2);

Then, you could load an XML file into a new DOM, and transform it... (either to a string, or new Dom object)
Code:
var newText, newDom;
newText = xmlDom.transformNode(xslDom2);
xmlDom.transformNodeToObject(xslDom3, newDom);

It is VERY possible that there are errors in the above code examples, but they should be a good generalization of what you need to do...

Hope this was a litle help...
-Josh

Visit My Site
PROGRAMMER: (n) Red-eyed, mumbling mammal capable of conversing with inanimate objects.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top