Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7759693
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T13:41:46+00:00 2026-06-01T13:41:46+00:00

Please help with the following: I have an input file that is quite heterogeneous

  • 0

Please help with the following:

I have an input file that is quite heterogeneous and big.

I need to run individual tests on individual nodes and in the end output a boolean value: did any test fail? or did they all pass?

Is there a good way to do that?

I’ve detailed bellow an example.

A simplified sample of input file:

<?xml version="1.0" encoding="utf-8"?>
    <Application>
      <PersonApplicants>
               <Person ApplicantType="Borrower" ApplicationType="Sole" >
                    <PersonName FirstName="Jane" Surname="Smith" />
                    <PersonalDetails CreditHistory="CleanCredit" YearsInCurrentProfession="12">
                        <Residency ResidencyStatus="Citizen" ResidencyCountry="Australia"/>
                    </PersonalDetails>
                </Person>
                <Person ApplicantType="Guarantor" ApplicationType="Sole" >
                    <PersonName FirstName="John" Surname="Smith" />
                </Person>
        </PersonApplicants>
      <CompanyApplicants>
        <Company ApplicantType="Guarantor" ApplicationType="Joint">
          <CompanyName CompanyName="C1" TradingName="C1" />
          <BusinessDetails YearsInBusiness="19" CreditHistory="CleanCredit" />
        </Company>
      </CompanyApplicants>
    </Application>

Run a series of individual tests on each node, and output at the end whether at least one of the test has failed or all have passed.

Output sample xml:

<TestResult>Failed</TestResult>

if any of the test failed
or

<TestResult>Passed</TestResult>

if all tests passed.

This is a sample of what i was trying to do:

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:output method="xml" encoding="utf-8" indent="yes"/>
    <xsl:strip-space elements="*" />
    <xsl:template match="/">
        <TestResult>
            <xsl:variable name="fail_test">
                <xsl:apply-templates select="Application" />
            </xsl:variable>
                <xsl:choose>
                    <!-- If any rule triggers/fails, output the following value "True".-->
                    <xsl:when test="$fail_test">True</xsl:when>
                    <!-- Otherwise putput the following value "False"-->
                    <xsl:otherwise>False</xsl:otherwise>
                </xsl:choose>
        </TestResult>
    </xsl:template>
    <xsl:template match="Application">
        <xsl:apply-templates select="PersonApplicants"/>
        <xsl:apply-templates select="CompanyApplicants"/>
    </xsl:template>
    <xsl:template match="PersonApplicants">
    <!-- Test Rule 1 Have at least one Borrower, Person or Company.  -->
    <xsl:variable name="var1">
        <xsl:choose>
            <xsl:when test="//Person/@ApplicantType='Borrower' or //Company/@ApplicantType='Borrower'"><xsl:copy-of select="true()" /></xsl:when>
            <xsl:otherwise><xsl:copy-of select="false()" /></xsl:otherwise>
        </xsl:choose>
    </xsl:variable>
    <!-- Test Rule 2 Only one applicant allowed for a Sole application, Person or Company. -->
    <xsl:variable name="var2">
        <xsl:choose>
            <xsl:when test="Person/@ApplicationType='Sole'">
                <xsl:choose>
                    <xsl:when test="count(//Person) + count(//Company) = 1"><xsl:copy-of select="true()" /></xsl:when>
                    <xsl:otherwise><xsl:copy-of select="false()" /></xsl:otherwise>
                </xsl:choose>
            </xsl:when>
            <xsl:otherwise><xsl:copy-of select="true()" /></xsl:otherwise>
        </xsl:choose>
    </xsl:variable>
<!-- need a way to handle the results on all Person nodes -->
<!-- this is only in here as a placeholder for the correct code -->
        <!-- Test child nodes of Person Applicants, i.e Person nodes. -->
        <xsl:for-each select="Person">
            <xsl:apply-templates select="."/>
        </xsl:for-each>
<!--******************************************************************-->
            <!--the returned value of the template-->
        <xsl:copy-of select="not($var1 and $var2)" />
<!--******************************************************************-->
   </xsl:template>

<xsl:template match="Person">
<!-- @ApplicantType LIXI 2.0 node Validation: is required -->
<xsl:variable name="var1">
    <xsl:choose>
        <xsl:when test="not (@ApplicantType) or string(@ApplicantType) =''"><xsl:copy-of select="true()" /></xsl:when>
        <xsl:otherwise><xsl:copy-of select="false()" /></xsl:otherwise>
    </xsl:choose>
</xsl:variable>


<!-- @PrimaryApplicant LIXI 2.0 node Validation: PrimaryApplicant is required when Applicant Type is Borrower -->
<xsl:variable name="var2">
    <xsl:choose>
        <xsl:when test="not (@PrimaryApplicant) or string(@PrimaryApplicant) =''">
            <xsl:choose>
                <xsl:when test="@ApplicantType='Borrower'"><xsl:copy-of select="true()" /></xsl:when>
                <xsl:otherwise><xsl:copy-of select="false()" /></xsl:otherwise>
            </xsl:choose>
        </xsl:when>
        <xsl:otherwise><xsl:copy-of select="true()" /></xsl:otherwise>
    </xsl:choose>


        <!--the returned value of the template-->
    <xsl:copy-of select="not($var1 and $var2)" />
<!--******************************************************************-->
</xsl:template>

</xsl:stylesheet>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T13:41:48+00:00Added an answer on June 1, 2026 at 1:41 pm

    Simplest, from where you are would be

    <xsl:template match="/">
        <TestResult>
            <xsl:variable name="fail_test">
                <xsl:apply-templates select="Application" />
            </xsl:variable>
            <xsl:choose>
            <xsl:when test="contains($fail_test,'false')" >Failed</xsl:when>
        <xsl:otherwise>Passed</xsl:otherwise>
        </xsl:choose>
        </TestResult>
    </xsl:template>
    

    Note the end of your test sylesheet isn’t well formed and /xsl:if should be /xsl:choose

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Please can someone help? I have the following code which uploads a file to
Can you please help anyone?. I have a hash value as following. I need
Please help with SQL Query to solve following issue. I have a table input
Please help regarding the following issue. I have enabled the Block popup option in
Please help me with following, I have a database which contain strings ( e.g.
Please help me with following problem. In my android assets folder I have xml
Can anyone please help. I'm following a tutorial found here as I have a
Please kindly help me in the following, I have $sub = C:\views\sght\gzad\text\hksdk\akldls\hool.java = C:\views\sght\bdsk\text\hksdfg\sdjks\same.java
Please help with the following error that I get with Spring Security 3.05 and
Please help me to improve the following script: http://jsfiddle.net/n9BkM/8/ I need the following fucntionality:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.