We help IT Professionals succeed at work.

# XSLT- Trying to negate a String() function

on
684 Views
I have attached some XSLT code, the code is fairly repetitive in that a a template i have replaced with the comment   <!--DO STUFF1() --> is called in two places.

I think I could improve the code by using a negating my NOT condition, but I cant seem to make it work properly.

I want to try and say <xsl:when test="
string(substring-after(substring-after($path, '\'), '\')) "> OR'ed with <xsl:when test="string(substring-after($path, '\')) ">

And help would be greatly received.

Even if its a complete restructure of the code.

Thanks

<xsl:choose>
<xsl:when test="starts-with($path,'\')"> <!-- Starts with \ - e.g \abc\def\ghi --> <xsl:choose> <xsl:when test="not (string(substring-after(substring-after($path, '\'), '\'))) ">
<!--DO STUFF1() -->
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="xxx">
<xsl:with-param name="$path" select="substring-after(substring-after($path, '\'), '\')"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:choose>
<xsl:when test="not (string(substring-after($path, '\'))) "> <!--DO STUFF1() --> </xsl:when> <xsl:otherwise> <xsl:call-template name="xxx"> <xsl:with-param name="$path" select="substring-after(\$path, '\')"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>

Comment
Watch Question
Information Architect
CERTIFIED EXPERT
Top Expert 2006
Commented:
This problem has been solved!
###### Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

Deciding to stick with EE.

Mohamed Asif

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant