xsl-list
[Top] [All Lists]

paratheses and or (|) operator? --converting old WD stylesheet

2005-01-07 09:46:03
XSL List:

I'm trying to convert an older http://www.w3.org/TR/WD-xsl based stylesheet and run across the following problem (simplified) section:

<xsl:choose>
<xsl:when test="/metadata[($any$ idinfo/(descript/(abstract | purpose | supplinf) | browse/browsen) != '')]"> <p><b>Abstract:</b><xsl:value-of select="/metadata/idinfo/descript/abstract" /> </p>
       </xsl:when>
       <xsl:otherwise>
           <p>No descriptive information found.</p>
       </xsl:otherwise>
   </xsl:choose>

With the $any$ token and paratheses, this doesn't work in XPath 1.0. I've converted this to (which works):

   <xsl:choose>
       <xsl:when test="/metadata[idinfo/descript/abstract |
                                 idinfo/descript/purpose |
                                 idinfo/descript/supplinf |
                                 idinfo/browse/browsen != '']">
<p><b>Abstract:</b><xsl:value-of select="/metadata/idinfo/descript/abstract" /> </p>
       </xsl:when>
       <xsl:otherwise>
           <p>No descriptive information found.</p>
       </xsl:otherwise>
   </xsl:choose>

My question: is there a simpler way to translated the nested paratheses of the WD orginal into XPath 1.0? In some cases, I have 30-40 elements being tested by this nested approach.

Thanks,

-Eric

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>