Reference a sibling attribute

G

GIMME

We have :

<r>
<b>
<a type="edit"/>
</b>
<b>
<a type="submit"/>
</b>
</r>

When processing b elements what expression returns the
value of an a element type ?

Thanks.
 
A

Alex Shirshov

Hello, GIMME!
You wrote on 9 Apr 2004 19:01:10 -0700:

G> <r>
G> <b>
G> <a type="edit"/>
G> </b>
G> <b>
G> <a type="submit"/>
G> </b>
G> </r>

G> When processing b elements what expression returns the
G> value of an a element type ?

I think, it is better to you just buy a good book about XPath and XSLT.

The path for your question is
a/@type

With best regards, Alex Shirshov.
 
G

GIMME

Same example, with the elements names swapped out...
r with html, b with td and a with input.

Alex's suggestion, translating into input/@type falls short ...

Care to give it another look? (Big thanks in advance...)

<html>
<td>
<input type="edit"/>
</td>
<td>
<input type="submit"/>
</td>
</html>

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:eek:utput method="html"
doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
encoding="UTF-8"/>
<xsl:template match="html">
<xsl:for-each select="td">
<xsl:if test="input/@type='select'">
found select
</xsl:if>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top