[SOLVED] Validate phone XSLT 1.0

Issue

This Content is from Stack Overflow. Question asked by Hitoshi Mario Naga Mait

i want need help about validate phone number when the first number have some static number for every phone. like phone number for home,and company or and from handphone , i want trying detecting and validate the number was valid or not. how to take number after 62 and 021. thanks for help

Sample number :

6281234567890 and 02141234567 



Solution

i need to take the number after 62 and 021

You could do something like:

<xsl:choose>
    <xsl:when test="starts-with(phone, '021')">
        <xsl:value-of select="substring-after(phone, '021')" />
    </xsl:when>
    <xsl:when test="starts-with(phone, '62')">
        <xsl:value-of select="substring-after(phone, '62')" />
    </xsl:when>
    <xsl:otherwise>???</xsl:otherwise>
</xsl:choose>

Don’t see what this has to do with validation.


This Question was asked in StackOverflow by Hitoshi Mario Naga Mait and Answered by michael.hor257k It is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?