Xslt get value of created xml element -


<xsl:when test="conditon = 'value1'">     <typeid>4</typeid> </xsl:when> <xsl:when test="conditon = 'value2'">     <typeid>4</typeid> </xsl:when> <xsl:when test="conditon = 'value3'">     <typeid>4</typeid> </xsl:when> .... .... 

i have above. want check condition on created xml tag (typeid). i.e, below condition in xslt file,

<xsl:if test="$typeid = 4"> <price>100</price> </xsl:if> 

so, how can use above condition on created tag (above typeid created tag on want make condition)

or other way achieve above?

$typeid refers variable named typeid, , not element have created.

what can do, define variable called typeid set value want, , use variable create element, , check in condition.

<xsl:variable name="typeid">   <xsl:choose>     <xsl:when test="conditon = 'value1'">1</xsl:when>     <xsl:when test="conditon = 'value2'">2</xsl:when>     <xsl:when test="conditon = 'value4'">4</xsl:when>   <xsl:choose> </xsl:variable>  <typeid>   <xsl:value-of select="$typeid" /> </typeid>  <xsl:if test="$typeid = 4">   <price>100</price> </xsl:if> 

do note code have in same block of code, typeid variable local in scope block.


Comments

Popular posts from this blog

html - How to set bootstrap input responsive width? -

javascript - Highchart x and y axes data from json -

javascript - Get js console.log as python variable in QWebView pyqt -