|
Subject: [xsl] How to test if a named attribute exists. From: Imrran Wahid <devguy2003@xxxxxxxxx> Date: Mon, 10 Mar 2003 08:24:50 -0800 (PST) |
Let's say I have a document:
<parent>
<child atrrib1="apples" attrib2="pears"/>
<child attrib1="cars" attrib3="planes"/>
</parent>
I would like to do a test to determine if a named
attribute exists in one or more of the child elements.
If the attributes were elements, I can do this with a
count of all the named elements below the <parent>
element. For example if I have the named elements in a
lookup table, I can use the following to check for the
existence of each of the elements using the element's
name from the lookup table as follows:
<xsl:for-each select="$lookup-node/*">
<xsl:variable name="ItemName"
select="string(name(.))"/>
<xsl:if
test="count($parent-node//*[name(.)=$ItemName]) >
0">
<th><xsl:value-of select="$ItemName"/></th>
</xsl:if>
</xsl:for-each>
But I do not know how to do the same in the case of
attributes.
Can anyone help me with this? Thanks.
Imrran
__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - forms, calculators, tips, more
http://taxes.yahoo.com/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| RE: [xsl] Xpath patern question, Américo Albuquerque | Thread | Re: [xsl] How to test if a named at, Jeni Tennison |
| [xsl] Xpath patern question, Hélder Sousa | Date | Re: [xsl] substring for whole words, Dimitre Novatchev |
| Month |