xsl-list
[Top] [All Lists]

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

2021-06-22 22:49:36
On Tue, Jun 22, 2021 at 10:34 PM Roger L Costello costello(_at_)mitre(_dot_)org 
<
xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com> 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
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--
<Prev in Thread] Current Thread [Next in Thread>