Wednesday, March 28, 2012

Text Comparision in XSLT

hi guys,

I am working with XSLT these days. XSLT i am using is generating a HTML using a xml doc and list of arguments.

I also have a list of strings stored somewhere in cache. now I need to check if text coming from XML contains a word from string list...provide a link to that word.

Storing that string list can be changed to some text file or DB whatever is possible.

Now is it possible to do string comparision through XSLT??

Please reply asap...thanks.

-Geek

Hi

I think you can, using something like

<xsl: for-each select="t:fieldName">
<xsl: choose>

<xsl: when test="contains('value')">
' do what you want to do here
</xsl: when>

<xsl: when test="contains"('anothervalue')">
'do what you want to do here
</xsl: when>

</xsl: choose>
<xsl: for-each>

Hope that helps

0 comments:

Post a Comment