ADO, XML accessing a row context

admin

Administrator
Staff member
Hi All,I am trying to access at the data level the Attribute Name and produce aconditional statement based upon that Attribute Name. I'm new to XSL\XMLso I'm having a problem with the syntax to get it working.Here is a portion of the xsl file:<?xml version="1.0"?><xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl"><xsl:script xmlns:xsl="http://www.w3.org/TR/WD-xsl"><![CDATA[var nRow = -1;function nextRow(nNext){nRow=nNext-1;return "";}function getAttribValue(oNode){var sAttribName = oNode.getAttribute("name");try { var sAttribValue = oNode.ownerDocument.selectSingleNode("//z:row["+ nRow.toString() + "]").getAttribute(sAttribName) }catch(e){return "";}if ( sAttribValue==null ){return "NULL";} else {return sAttribValue;}}]]></xsl:script><xsl:template match="//z:row"><xsl:eval>nextRow(childNumber(this))</xsl:eval><TR><xsl:for-each select="//s:AttributeType"><TD ALIGN="left"><xsl:eval no-entities="t">getAttribValue(this)</xsl:eval></TD></xsl:for-each></TR></xsl:template>-------------------------Here is a portion of the XML file:<rs:data><z:row ID='1' LastName='Cape' FirstName='Karen' MI='L'/><z:row ID='2' LastName='Cassidy' FirstName='Trent' MI='D'/></rs:data>What I need to add to the above xsl code is a conditional statement basedupon the "ID" Attribute name. (The above code does work).I have tried:<xsl:choose><xsl:when test=".[nodeName()='ID']"><A><xsl:attribute name="HREF">test.asp?NameID=getAttribValue(this)</xsl:attribute></xsl:when></xsl:choose>Actually I have tried more than that but basically I need the syntax on howI can write a conditional statement based upon the attribute name. (Thiscode produces a table and I want to add a link/a href on only the id columnof the table).Thanks so much!!!
 
Back
Top