xml - How do I create a content node based on different conditions, using xsl:if-else? -


right now, i'm creating following node based off text of headerlistimport div.

<content name="importbizpartner">   <xsl:value-of select="//div[@class='headerlistimport']/a/text()" /> </content> 

the problem text node empty. in case, want contents of node 'no name available'.

i know, should know how this, i'm drawing blank. application allows me use xsl:if-else, i'm not sure of sytax. appreciated.

you should go xsl:choose, xslt doesn't have xsl:if-else element:

<content name="importbizpartner">     <xsl:choose>         <xsl:when test="not(//div[@class='headerlistimport']/a/text())">             <xsl:value-of select="//div[@class='headerlistimport']/a/text()" />         </xsl:when>         <xsl:otherwise>             no data available         </xsl:otherwise>     </xsl:choose> </content> 

Comments

Popular posts from this blog

php - render data via PDO::FETCH_FUNC vs loop -

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

The canvas has been tainted by cross-origin data in chrome only -