Tony and Jon, your kindness is without peer. Thank you for your quick response.
I found a solution that uses the Msxml2 active x object and two xsl templates to create a unique set of values and then sort them and display them in an html document.
Tony, I am such a greenhorn that your solution raises several questions. I am going to post them, but please do not feel obligated to answer. But I'm am intrigued by your solution, and wonder if it is faster than mine. Here's the questions:
1) Is all of your xsl in a single file?
2) About the use of the SortedItems variable. It looks like the structure of your xml document is something like this:
<SYSTEM>
<TABLE>
<OCC>
<FIELD2>text node</FIELD2>
<FIELD3>text node</FIELD3>
</OCC>
</TABLE>
</SYSTEM>
and you are sorting FIELD2 and FIELD3. When you call your SortedItems variable, the node set is $SortedItems/OCC. Doesn't the variable already contain the OCC node? If so, why do you have to specify the OCC node in the expression? Is it because the OCC nodes are siblings, and have to be present in the expression so the [$position - 1] location expression will work?
3) When creating populating the SortedNodes variable, what does the xsl:copy-of command do?
4) What do either the saxon node-set or msxsl node-set functions do to your $SortedNode/OCC node set?
5)And finally a comment. In my xml document, the nodes I am working with are not siblings. Rather, they are very distant cousins, at the same level down from ancestors that are siblings, so I suspect that the idea of [position() - 1] will not work. Here's an example of one of the siblings:
<ID value="1">
<PBG value="CPI">
<Division value="AL">
<KPU value="AL">
<Technology value="PVD">
<Upper_Technology_Node value="<None>">
<Platform_Name value="ENDURA">
<Application_Area value="Al IC">
<Process_Step value="Al Fill">
<Process_Detail value="Barrier/ Al/ Arc-TiN">
<Primary_Customer_Interest_Code value="Metallization">
<Secondary_Customer_Interest_Code value="Al">
[Red]<Applied_Product_Name value="Endura Al Fill PVD">[/Red]
<Release_Status value="Customer Release">
<Refurb_Available value="<None>">
<Demo_Status value="Demo">
<Wafer_Size value="200mm">
<Device_Area value="<None>">
<Device_Type value="<None>">
<Lower_Technology_Node value="<None>">
<Official_Product value="Applied Endura Al PVD">
[red]<Actively_Marketed value="Yes" />[/red]
</Official_Product>
</Lower_Technology_Node>
</Device_Type>
</Device_Area>
</Wafer_Size>
</Demo_Status>
</Refurb_Available>
</Release_Status>
</Applied_Product_Name>
</Secondary_Customer_Interest_Code>
</Primary_Customer_Interest_Code>
</Process_Detail>
</Process_Step>
</Application_Area>
</Platform_Name>
</Upper_Technology_Node>
</Technology>
</KPU>
</Division>
</PBG>
</ID>
The node I am interested in (Applied_Product_Name) is 13 levels down from its ancestor, and the filtering value (Actively_Marketed) is 22 levels down. The Applied_Productd_Name is not unique to the document, so I need to create a set of unique values and then sort them alphabetically. Here's the xsl template that creates the unique values:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="
<xsl

utput method="xml" version="1.0" encoding="iso-8859-1" indent="yes" />
<xsl:template match="/">
<data>
<xsl:for-each select="//Applied_Product_Name/@value[not(. = preceding::*/@value)][//Actively_Marketed[@value='Yes']]">
<xsl:variable name="thisName" select="." />
<ele>
<xsl:value-of select="$thisName" />
</ele>
</xsl:for-each>
</data>
</xsl:template>
</xsl:stylesheet>
This creates an xml document that is then sent to an xsl template to be sorted. (The created xml document moves the desired value from an attribute of the Applied_Product_Name node to a text node of the ele node). The transformation below sorts and outputs the desired values into an html form select field:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="
<xsl

utput method="html" />
<xsl:template match="/">
<form>
<select>
<xsl:for-each select="//ele">
<xsl:sort select="." />
<xsl:variable name="thisName" select="." />
<option value="$thisName"><xsl:value-of select="." /></option>
</xsl:for-each>
</select>
</form>
</xsl:template>
</xsl:stylesheet>
The html file below uses the Msxml2.DOMDocument Active X Object methods to do the labor:
<html>
<head>
<title>iMark q_tax.cfm</title>
</head>
<script language="javascript">
function init(){
// load xml file into dom object
var xmlSrc = new ActiveXObject("Msxml2.DOMDocument.3.0");
xmlSrc.async = false;
xmlSrc.load("../iMarketingTaxonomy/application.xml");
// load the xsl file that returns unique values
xslSrc = new ActiveXObject("Msxml2.DOMDocument.3.0");
xslSrc.async = false;
xslSrc.load("../iMarketingTaxonomy/uniqueValues.xsl");
// transform the xml file into a unique set of desired values
var tmpStr = xmlSrc.transformNode(xslSrc);
// load the unique value string into the xml DOMDocument object
xmlSrc.loadXML(tmpStr);
// load the xsl file that returns sorted values as an html form select field
xslSrc.load("../iMarketingTaxonomy/sortedValues.xsl");
// transform the unique values xml into the sorted values
tmpStr = xmlSrc.transformNode(xslSrc);
// write the unique, sorted html select field to the div
resTree.innerHTML = tmpStr
}
</script>
</head>
<body onload="init();">
<div id="resTree"></div>
</body>
</html>
So, that's the long-winded picture. I don't expect a response to this lengthy post, but am interested in any comments from your experience, which is much greater than mine. Thank you very much.
Bill