Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 25th, 2007, 06:51 PM
Authorized User
 
Join Date: Jun 2006
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default Checking for valid child elements.

Hi there,

I am not if it is possible to check for valid child elements of a parent before processing the parent. to give an example as shown below where I regenerate the whole node-set of the parent (being test1, test2 etc) if the descendants are valid.


<ValidateDataTypes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <Test1>
        <string_20>apple</string_20>
        <boolean_YN>yes</boolean_YN>
        <decimal_3>12.456</boolean_YN>
    </Test1>
    <Test2>
        <string_Nullable/>
        <payment>
            <decimal_2>25.78</decimal_2>
        </payment>
    </Test2>
    <Test3>
        <payment>
            <decimal_2>125.789</decimal_2>
        </payment>
    </Test3>
</ValidateDataTypes>


the desired output should be

<ValidateDataTypes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <Failed>
        <string_20>string length is not 20</string_20>
        <boolean_YN>only 1 char allowed</boolean_YN>
        <decimal_3>12.456</boolean_YN>
    </Failed>
    <Test2>
        <string_Nullable/>
        <payment>
            <decimal_2>25.78</decimal_2>
        </payment>
    </Test2>
    <Failed>
        <payment>
            <decimal_2>only 2 decimal places allowed</decimal_2>
        </payment>
    </Failed>
</ValidateDataTypes>


thanks





Similar Threads
Thread Thread Starter Forum Replies Last Post
checking for a child? gabster XSLT 2 March 7th, 2007 02:18 PM
Access specific Element and its Child elements! suersh79 XML 3 November 22nd, 2006 12:58 AM
Opening MDI Child on Button Click of MDI Child Sachin Shinde Visual Studio 2005 0 June 8th, 2006 05:05 AM
Add attribute to the parent after checking child kinnur XSLT 10 May 30th, 2005 06:07 PM
valid crmpicco Classic ASP Basics 1 February 17th, 2005 12:54 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.