Re: [xsl] Is XPath and/or XSLT designed such that I should never have to write special case code?

Subject: Re: [xsl] Is XPath and/or XSLT designed such that I should never have to write special case code?
From: "Mukul Gandhi mukulg@xxxxxxxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 23 Jun 2021 03:49:29 -0000
On Tue, Jun 22, 2021 at 10:34 PM Roger L Costello costello@xxxxxxxxx <
xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:


> <xsl:if test="empty(Cell[2]/Data)"> do something </xsl:if>
>
> Bad, bad, bad.
>


>
> Question #1: is XPath and/or XSLT designed such that I should never have
> to write special case code?
>
> Question #2: If I find myself writing special case code, should I stop and
> say, "How can I modify this XPath and/or XSLT so that I do not have to
> write special case code?
>

I don't think that, using an "if" (xsl:if / xsl:choose in XSLT, "if" in
XPath) control flow mechanism in the code (and equally well in XSLT) is
always a bad idea. It's an integral programming tool to solve problems. To
have code look nicer, may be we can encapsulate the "if" logic within a
function.


-- 
Regards,
Mukul Gandhi

Current Thread