Re: [xsl] Testing for certain combinations

Subject: Re: [xsl] Testing for certain combinations
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Thu, 8 Nov 2001 13:09:08 +0000
Hi Neil,

> I need a way of testing whether or not I have 3 or more <a> links
> separated only by <br/> tags within a <p>.

Given the current node is a p element, perhaps something like:

  not(text()[normalize-space()]) and
  a[3] and br[3] and
  not(a[following-sibling::*[1][not(self::br)]])

This would return true for a p element if:

 - it doesn't contain text that contains anything other than whitespace
 - it has at least three a and br element children
 - all its a element children's immediately following siblings are br
   elements

> For those interested, I'm developing a stylesheet to transform our
> XML into WML for UP browsers. The UP browser (eg Siemens and
> Motorola phones) displays option lists better than link lists.

Sounds as though it would be easier if you changed the XML so that
it's more content-oriented. If it looked like:

<links>
  <link href="urlwhatever">Labelwhatever</link>
  ...
</links>

then you could transform it easily both into the WML and HTML (or
whatever) formats.

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread