Print

Print


[log in to unmask] on Friday 01 February 2008 08:45:

> > I have an XSL question. I'm trying to select <c0x> entries with 
> > certain <pername>s in the <unittitle> (always a child of <did>) but 
> > my xsl only finds those where the searched-for name occurs first 
> > (when there are multiple names). How can I fix the test? Here is what I 
> > have:
> >                 <xsl:for-each select="//*[@otherlevel='init' and 
> > (contains(./did//persname, $SearchName) or 
> > contains(./did//persname/@normal, $SearchName))]">
> >                         <xsl:call-template name="init-display"/>
> >                 </xsl:for-each>
> > The problem is that (contains(./did//persname $SearchName)) only 
> > tests the first <persname> in a given unittitle. Can someone tell me 
> > how to address this?


> You're working in XSLT 1.0, which gives you the first instance and lets
> you get away with it. 

> In XSLT 2.0 you'd get a Run-time error. In Saxon:
> XPTY0004: A sequence of more than one item is not allowed as the first
> argument of contains() ("Frans Laarmans", "Jules Valenpint", ...) 
> Transformation failed: Run-time errors were reported


> You might try 

> <xsl:for-each select="//*[@otherlevel='init']/did//persname[contains(., $SearchName) 
> or contains(@normal, $SearchName)]">


or 
<xsl:for-each select="//*[@otherlevel='init'][did//persname[contains(., $SearchName) 
or contains(@normal, $SearchName)]]">

if that's what you're after


Regards, 

Dirk van Laanen