Xslt: populate innertext value of <a href="" /> in xslt during runtime -


i tried lot see if suggestion/answer satisfy requirement not find any.

i have xml file using output html file using xsltransform api , xslt stylesheet.

my xml file has rootnode have 2 attributes - hyperlinkdisplaytext , hyperlinkvalue. xml file generated @ runtime. so, values of these attributes not known @ compile time.

my requirement html output should display hyperlink display text needs taken value of 'hyperlinkdisplaytext' , hyperlink value needs taken value of "hyperlinkvalue'.

for example,

<rootnode hyperlinkdisplaytext="google" hyperlinkvalue="https://www.google.com/" /> 

this needs appears google.

for this, tried several things in xslt. below snapshot trying in xslt file -

<xsl:choose>   <xsl:when test="@hyperlinkdisplaytext , @hyperlinkvalue">     <h4 style="font-family: arial" align='center'>       <a href="{./@hyperlinkvalue}">@hyperlinkdisplaytext</a>     </h4>   </xsl:when>   <xsl:otherwise>   </xsl:otherwise> </xsl:choose> 

it not working. highly appreciated.

regards, kvk938

change <a href="{./@hyperlinkvalue}">@hyperlinkdisplaytext</a> <a href="{@hyperlinkvalue}"><xsl:value-of select="@hyperlinkdisplaytext"/></a>. assumes context node rootnode element.


Comments

Popular posts from this blog

c++ - CryptStringToBinary API behavior -

c++ - Correct method for redrawing a layered window -

java.util.scanner - How to read and add only numbers to array from a text file -