Re: [xsl] Testing Text

Subject: Re: [xsl] Testing Text
From: "Ganesh Babu N" <nbabuganesh@xxxxxxxxx>
Date: Thu, 8 Jan 2009 16:35:39 +0530
Sorry David for parapharsing the error/warning messages.


I got a solution for this with the expression contains(text()[1],
'@'). But is working in some places and not working in other places.

<xsl:template match="*">
     <xsl:if test="contains(text()[1],'@')">@ found in <xsl:value-of
select="name(.)"/></xsl:if>


In the snippet it showing that the '@' present in <atl>
<atlgrp>
  <atl>Child to adult socioeconomic @ conditions and obesity in a
national cohort</atl>
  <runtl>Child to adult social conditions and obesity</runtl>
</atlgrp>


In this snippet it not showing any information.
<abs>
 <p>
  <b>OBJECTIVE</b>: Critical stages in childhood are suspected for
adult obesity. We sought to identify (i) whether risk of adult obesity
is influenced by childhood socioeconomic conditions in addition to
those in adulthood; and (ii) whether conditions in childhood act
independently or through their association with education or parental
obesity.</p><p>
  <b>DESIGN:</b> Longitudinal, 1958 British birth cohort.</p><p>
  <b>SUBJECTS:</b> A total of 11&amp;thinsp;405 men and women followed
to age 33&amp;thinsp;y.</p>
 <p>
  <b>MEASUREMENTS:</b> Social class at birth and ages 7, 11, 16, 23
and 33&amp;thinsp;y. Obesity (BMI&amp;ges;30) at age
33&amp;thinsp;y.</p>
 <p>
  <b>RESULTS:</b> Social class was related to obesity,
cross-sectionally at ages 16 (women), 23 and 33&amp;thinsp;y, but not
at younger ages. In analysis of adult obesity (age 33&amp;thinsp;y)
and social class at five life stages, class at age 7&amp;thinsp;y
significantly predicted obesity for women (adjusted odds ratio
(OR)&amp;equals;1.31, that is, the odds increased by 31&amp;percnt;
for each decrease in social class). For men, class at birth and age
23&amp;thinsp;y predicted adult obesity (adjusted OR&amp;equals;1.19
and 1.16, respectively). Education was also associated with adult
obesity, increasing the odds by 30&amp;percnt; (men) and
35&amp;percnt; (women) for each decrease in qualification level.
Adjustment for education level and parental BMI did not abolish the
effect on adult obesity of class at age 7&amp;thinsp;y among women,
nor of class at birth among men, while class at age 23&amp;thinsp;y
reduced to borderline significance.</p>
 <p>
  <b>CONCLUSIONS:</b> Cross-sectional associations for social class
and obesity can be misleading and obscure effects of childhood
socioeconomic conditions. Influences around birth to age
7&amp;thinsp;y have a long-lasting impact on the risk of a@dult
obesity.</p>
  <artbiblio>
   <it>International Journal of Obesity</it> (2003) <b>27,</b>
1081&amp;ndash;1086.  doi:<extlink
type="doi">10.1038/sj.ijo.0802323</extlink>
 </artbiblio>
</abs>

Please help me in searching the string in a compete file.

Regards,
Ganesh

On Thu, Jan 8, 2009 at 2:54 PM, David Carlisle <davidc@xxxxxxxxx> wrote:
>
>> it is showing error as multiple item list can not be the argument of
>> contains
>
> yes this was explained by Wendell
>
>
>> it is showing error as text node will not select any thing.
>
> Please don't paraphrase error messages. If you get an error message
> state exactly what it is.
>
> If it's saxon's warning (which is not an error message) then the text()
> must be being evaluated at something other than an element node (eg an
> attribute) which would not happen if teh match pattern was * as in teh
> code that I posted.
>
> David
>
>
> ________________________________________________________________________
> The Numerical Algorithms Group Ltd is a company registered in England
> and Wales with company number 1249803. The registered office is:
> Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.
>
> This e-mail has been scanned for all viruses by Star. The service is
> powered by MessageLabs.
> ________________________________________________________________________

Current Thread