Jenn
Jenn

Reputation: 35

How to limit length of phone number in xslt

I need to return phone number, but only if it is 10 digits. How do I modify the below to say 'only return the number if its truly 10 digits', otherwise return nothing?

<HomePhoneNumber>
   <xsl:value-of select="ws:Additional_Information/ws:Home_Phone"/>
</HomePhoneNumber>    

Thanks so much! Jenn

Upvotes: 1

Views: 167

Answers (1)

Tim C
Tim C

Reputation: 70638

Try this.....

<xsl:value-of select="ws:Additional_Information/ws:Home_Phone[string-length(.) = 10]"/>

Upvotes: 1

Related Questions