Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Selecting an attribute of a tag using the innertext to search for

Status
Not open for further replies.

jvrzl

Programmer
Mar 12, 2009
1
NL
Hi Can somebody help me?
I try to find the attribute within the following xml part: by querying on the text within the field tag

<tableview>
<field width="70">id</field>
<field width="100">naam</field>
</tableview>

I googled for an hour or so unfortunately I couldn’t find the solution.
I tried something like this:

../../../tableview[field = $fieldName]/@width


and lots of other variants bud it just doesn’t seems to work
desperately I ended up using:


<xsl:attribute name="style">
<xsl:for-each select ="../../../tableview/field" >
<xsl:if test =".=$fieldName">
width:<xsl:value-of select="@width"/>px;
</xsl:if>
</xsl:for-each>
</xsl:attribute>


It works bud is so ugly.
Who Knows the answer

thanks
 
[tt] ../../../tableview/field[.=$fieldName]/@width[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top