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

Subject: [xsl] paratheses and or (|) operator? --converting old WD stylesheet
From: Eric Compas <edcompas@xxxxxxxx>
Date: Fri, 07 Jan 2005 10:46:03 -0600
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

Current Thread