xsl-list
[Top] [All Lists]

[xsl] Data validations on XML elements..

2009-04-09 01:33:49
abc.xml

<?xml version='1.0'?>
<?xml-stylesheet href="abc.xsl" type="text/xsl"?>

<params>
    <abc>
            <name>machine_ip</name>
            <label>Machine IP</label>
            <type>number</type>
            <mandatory>yes</mandatory>
            <desc>specify target machine ip</desc>
    </abc>
    <cliswitch>1</cliswitch>
</params>
---------------------------------------------------------------------------------------------------------
abc.xsl

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>

<xsl:template match="params">
    <table border="1">
    <form name="abcfile" method="POST" action="abc.cgi">
            <tr class="header_class">
                <td> Parameter </td>
                <td> Description </td>
                <td> Value </td>
            </tr>
            <xsl:apply-templates select="abc" />
    </form>
</xsl:template>

<xsl:template match="abc">
    <tr class="form_td">
        <td>
            <xsl:value-of select="label"/>
        </td>
        <td>
    <xsl:value-of select="desc"/>
        </td>
        <td>
             <input type="text" name="args1" value="{$value}">
             </input>
        </td>
    </tr>
</xsl:template>

</xsl:stylesheet>

Here,I want that user should only enter IP's in the text box 'args1' in form of
"digit.digit.digit.digit". Can I specify these things in XML?I am
currently not using 'mandatory' and 'Type' fields from XML.

If not,has the XSL,the power to accept only interger values in this
text box as 'Type' is specified as 'number' in XML File?

action form "abc.cgi" can recognize that,but that won't be a generic solution.

I am using Perl:LibXSLT processor.
---------------------------------
Thanks and Regards,
Himanshu Padmanabhi

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>