This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: Checking whether node value is string or not.


Hello Mukul,
Hi Mukul,

"Johan123" is a perfectly good string, so's "123" for that matter. 

It sounds like you want to disallow any node whose value contains a number
character.
One way would be to remove any numeric characters and see if the node value
has shrunk. If it has then it had a number in it and you don't want it:

<xsl:if test="string-length(translate(.,'0123456789','')) =
string-length(.)">
	<!-- allow the node -->
</xsl:if>

hope it works,
Tom Weissmann

> -----Original Message-----
> From: Mukul.Mudgal@etindia.com [mailto:Mukul.Mudgal@etindia.com]
> Sent: 30 May 2002 07:09
> To: xsl-list@lists.mulberrytech.com
> Subject: [xsl] Checking whether node value is string or not.
> 
> 
> Hello Friends
> 
> Is it possible to check the value of a node ...I mean if it 
> is string then
> it allow it in result document otherwise discard it.
> 
> <Node>Johan</Node>
> <Node>Smith</Node>
> <Node>123Johan</Node>
> <Node>Johan123</Node>
> <Node>123456</Node>
> <Node>Sarah</Node>
> 
> After conversion
> 
> <ResultNode>Johan</ResultNode>
> <ResultNode>Smith</ResultNode>
> <ResultNode/>
> <ResultNode/>
> <ResultNode/>
> <ResultNode>Sarah</ResultNode>
> 
> 
> 
> Thanks
> 
> Mukul
> 
> 
> 
> 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]