xml - How to compare the value of the current for-each element? -


xml:

<a>1</a> <a>2</a> <b>3</b> <a>4</a> <b>5</b> 

desired output:

value value value b value     value b 

xslt:

<xsl:for-each select="a | b">   <xsl:if test="? = 'a'">      value   </xsl:if>   <xsl:if test="? = 'b'">     value b   </xsl:if> </xsl:for-each> 

how compare value of current element in line <xsl:if test="? = 'a'"> , <xsl:if test="? = 'b'">?

you need name(), strange way of going it. posted, want output names of nodes. in case:

<xsl:apply-templates select='a|b' />  <xsl:template match='a|b'>     value <xsl:value-of select='name()' /> </xsl:template> 

Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -