This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Crazy idea: loopback namespace



so you want to use def if foo is either not set or is set to empty
string?


<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                version="1.0"
                >

<xsl:output method="xml" indent="yes"/>

<xsl:template match="/">
<xsl:call-template name="A"/>
<xsl:call-template name="A">
  <xsl:with-param name="foo" select="'aa'"/>
</xsl:call-template>
</xsl:template>


<xsl:template name="A">
    <xsl:param name="foo"/>

    <xsl:call-template name="B">
        <xsl:with-param name="foo" select="$foo"/>
    </xsl:call-template>
</xsl:template>

<xsl:template name="B">
    <xsl:param name="foo" />
    <xsl:variable name="foo2">
       <xsl:choose>
        <xsl:when test="$foo"><xsl:copy-of select="$foo"/></xsl:when>
        <xsl:otherwise>def</xsl:otherwise>
       </xsl:choose>
    </xsl:variable>
      [<xsl:value-of select="$foo2"/>]
</xsl:template>

</xsl:stylesheet>



bash-2.01$ xt js.xsl js.xsl
<?xml version="1.0" encoding="utf-8"?>

      [def]

      [aa]


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]