function sort(key) { // Find the "order-by" attributes in the style sheet. var s = document.XSLDocument.selectNodes("*/xsl:template[@match='menu'] //xsl:apply-templates/@order-by"); // Replace the values with the new sort key. for (var i = s.nextNode(); i != null; i = s.nextNode()) { i.value = key; } // Find the subset of the document we need to update. var d = document.XMLDocument.selectSingleNode("story/menu"); // Apply the style sheet to the subset, and update the display. menu.innerHTML = d.transformNode(document.XSLDocument); } 或许对你有用!
你试过就知道了。
输出的是XML的内容,而不是xml经xsl解释后的html。
// Find the "order-by" attributes in the style sheet.
var s = document.XSLDocument.selectNodes("*/xsl:template[@match='menu']
//xsl:apply-templates/@order-by");
// Replace the values with the new sort key.
for (var i = s.nextNode(); i != null; i = s.nextNode())
{
i.value = key;
}
// Find the subset of the document we need to update.
var d = document.XMLDocument.selectSingleNode("story/menu");
// Apply the style sheet to the subset, and update the display.
menu.innerHTML = d.transformNode(document.XSLDocument);
}
或许对你有用!