![]() |
![]() | ![]() | ![]() | Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - Re: Pattern problem >Thread Next - Re: Pattern problem Re: Pattern problemTo: NULL Date: 8/13/2008 3:18:00 PM
tshad wrote:
> ancestor::form/@name gives me 1007, as it should. But I need to look at all
> the forms on the same level and get the one that has @primary = 'true' and
> use the @name of that form.
>
> Is this the wrong way to get that?
>
> Seems pretty straight forward.
>
> I assume the pattern in:
>
> <xsl:value-of select="ancestor::form[@primary='true']/@name"/>
>
> says to look for all the ancestor "form" tags and look at the one that one.
> I did notice that I had primary set in my program without the "@". But even
> after changing it to the above is not working.
The sample XML you posted looks like this:
<Report>
<appraisal>
<data>
<form name="1007" primary="false">
<section type="subject" number="0">
<tag name="GR_AGE.1" flags="1" format="4096">4 Yrs.</tag>
</section>
</form>
<form name="reffee" primary="false">
<tag name="FFHD_NFIP_COMMUNITY_NUMBER.1" flags="0"
format="0">040040</tag>
</form>
<form name="1004_05" primary="true">
<section type="subject" number="0">
<tag name="PROP_PHYS_DEFICIENCIES_DESC.1" flags="4"
format="4096">None apparent </tag>
</section>
</form>
</data>
</appraisal>
</Report>
In that sample each 'tag' element has just one ancestor element of the
name 'form'. However each such 'form' element has siblings so perhaps
you want
<xsl:value-of select="(
ancestor::form[@primary = 'true'] |
ancestor::form/preceding-sibling::form[@primary = 'true'] |
ancestor::form/following-sibling::form[@primary = 'true']
)[1]/@name"/>
which looks at the sibling 'form' elements as well.
--
Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
| ![]() | ![]() | ![]() |
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | |||
|
