appname.getCache().getDocument('MTX_DATA_XML').selectNodes('//record[@jsxselected="1"]');
2.
format 1:
<data jsxid="jsxroot">
<record jsxtext="Jame Paulis" jsxid="1" office="1018" status="Interview" experience="3" longivity="1" ></record>
<record jsxtext="James" jsxid="2" office="1019" status="GD" experience="3" longivity="2" ></record>
<data/>
format 2:
<data>
<record>
<ID>1</ID>
<office>1018</office>
<status>Interview</status>
<experience>3</experience>
<longivity>1</longivity>
</record>
<record>
<ID>2</ID>
<office>1019</office>
<status>Group Discussion</status>
<experience>0</experience>
<longivity>3</longivity>
</record>
</data>
var nodeValueExp = objDoc.selectSingleNode("http://record[ID='1']/experience").getValue();
The following XSL will produce the output you wanted in format 2:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:template match="/">
<xsl:element name="data">
<xsl:for-each select="http://record">
<xsl:element name="record">
<xsl:for-each select="@*">
<xsl:choose>
<xsl:when test="name()='jsxid'"><xsl:element name="ID"><xsl:value-of select="."/></xsl:element></xsl:when>
<xsl:when test="name()='jsxtext'"></xsl:when>
<xsl:otherwise><xsl:element name="{name()}"><xsl:value-of select="."/></xsl:element></xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:element>
</xsl:for-each>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
You can use this XPath for format1:
//record[@jsxid='1']/@experience3.Is there a way to select items in a Select by pressing keys? For example I have a alphabetized list of States. I want to be able to press 'A' 4 times to move from Alabama, to Alaska, to Arizona, to Arkansas. Then I want to be able to press tab and move on to a zip code field. This should leave Arkansas selected.
This is the normal behavior for a simple html select box and I want to stick to what people are familiar with.function handleKeyPress(objSelect,objEvent) { //resolve the key the pressed;only listen for numbers and letters var intKey = objEvent.keyCode(); var strKey = String.fromCharCode(intKey); if(strKey.search(/[a-z0-9]/i) == -1) return true; var objKey = new RegExp(strKey,"i"); //get list of options for the select var objXML = objSelect.getXML(); var objTextNodes = objSelect.getXML().selectNodes("http://record[@jsxtext]"); //query the select box to see if the same key was pressed before; if so begin searching at he correct index var objState = objSelect.custom_index || {}; objState[strKey] = (objState[strKey] != null) ? objState[strKey] : 0; var intIndex = (objState[strKey] < objTextNodes.getLength()) ? objState[strKey] : 0; jsx3.log("index: " + objState[strKey]); objState[strKey] = 0; return true; }; function handleKeyPress(objSelect,objEvent) { //resolve the key the pressed;only listen for numbers and letters var intKey = objEvent.keyCode(); var strKey = String.fromCharCode(intKey); if(strKey.search(/[a-z0-9]/i) == -1) return true; var objKey = new RegExp(strKey,"i"); //get list of options for the select var objXML = objSelect.getXML(); var objTextNodes = objSelect.getXML().selectNodes("http://record[@jsxtext]"); //query the select box to see if the same key was pressed before; if so begin searching at he correct index var objState = objSelect.custom_index || {}; objState[strKey] = (objState[strKey] != null) ? objState[strKey] : 0; var intIndex = (objState[strKey] < objTextNodes.getLength()) ? objState[strKey] : 0; jsx3.log("index: " + objState[strKey]); //loop to find the next item in the list that begins with the given key for(var i=intIndex;i<objTextNodes.getLength();i++) { if(objTextNodes.getItem(i).getAttribute("jsxtext").search(objKey) == 0) { objSelect.custom_index = {}; objSelect.custom_index[strKey] = i+1; objSelect.setValue(objTextNodes.getItem(i).getAttribute("jsxid")); return false; } } //loop from 0 to current index to find the first item in the list that begins with the given key.(wrap around) //following was added by dlehman for(var i=0;i<intIndex;i++) { if(objTextNodes.getItem(i).getAttribute("jsxtext").search(objKey) == 0) { objSelect.custom_index = {}; objSelect.custom_index[strKey] = i+1; objSelect.setValue(objTextNodes.getItem(i).getAttribute("jsxid")); return false; } } objState[strKey] = 0; return true; };