Print

Print


In response to my query about searching for names when there are multiple
persnames in a single unittitle, several people suggested nested looping:

><xsl:for-each select="did">
>         <xsl:for-each select="./unittitle/persname">
>                 <xsl:if test="contains(string(.) , $SearchName)">
>                                 <xsl:call-template name="unittitle"/>
>                 </xsl:if>
>         </xsl:for-each>
></xsl:for-each>

The trouble with this is that it changes the context so that my
unittitle template (which is used repeatedly in the stylesheet) won't work.

Here's my workaround:
<xsl:for-each select="did">
         <xsl:variable name="GFI">
                 <xsl:for-each select="./unittitle/persname">
                                 <xsl:if test="contains(string(.) ,
$SearchName)">
                                 <xsl:text>Go For It</xsl:text>
                                 </xsl:if>
                 </xsl:for-each>
         </xsl:variable>
         <xsl:if test="$GFI='Go For It'">
                 <xsl:call-template name="unittitle"/>
         </xsl:if>
</xsl:for-each>

This works but seems clumsy to me. Anyone have a better idea?

N.B. the unititle//persname syntax someone suggested doesn't find all the
persnames.

Thanks,
Bob Walser



Bob Walser  [log in to unmask]
H: 1-612-377-9284  W: 1-612-374-4364
- -  -   -    -     -      -       -         -         -