Suppose i have an XML file, it contains some strings, now i have to write an xsl file to display the strings. there are some constraints to display the strings. 1. it should not display the strings with some special characters like +,/,=, etc. 2. it should display strings only with characters and _ . 3. if it having any other special characters it should display only ?. please help me. How can we validate it? suppose this is the xml file, here it should display only srinir and ramesh_l <?xml version="1.0" encoding="UTF-8"?> <emp> <name>srini r</name> <name>ralla+ srinu</name> <name>(rama)</name> <name>srinir</name> <name>ramesh_l</name> </emp> please help me. thanks in advance. srini.
quick.....dirty.....not-verified.....proposal: <xsl:for select = ...> <xsl:choose> <xsl:when test = "contains(./name, '+') || contains(./name, '(') || contains(./name, ' ') || contains(./name, '=') "> <!-- Do not display --> </xsl:when> <xsltherwise> <!-- Display the name --> </xsltherwise> </xsl:choose>
I think your choices are using the substring, substring-before, substring-after, contains and the translate functions. Personally, I would prefer the "application using" this XML to do the validation. I don't prefer a lot of validation in XSL. Hope you get the idea, I agree this is by no means a solution. regds. - madhav [ November 28, 2003: Message edited by: Madhav Lakkapragada ]