Xslt select attribute of element

09/01/2013 14:16

In case we have $Rows variable and want to take 'Title' attribute from first row of $Rows

<xsl:value-of select="$Rows[1]/@Title"/>

 

or in Content Query web part xml - Get listId of second Row element (321) - index start is 1, not 0

<xsl:value-of select="dsQueryResponse/Rows/Row[2]/@ListId" /> result 321

 <xsl:value-of select="dsQueryResponse/Rows/Row/@ListId" /> result 123 - if no index, first item is selected

 

for xml

<dsQueryResponse>
< Rows>
< Row ListId="123"/>
< Row ListId="321"/>
< /Rows>
< /dsQueryResponse>