Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

XSLT question

Options
  • 16-09-2005 4:15pm
    #1
    Registered Users Posts: 5,102 ✭✭✭


    Anyone know why this wont work?

    <?xml version="1.0" encoding="ISO-8859-1"?>
    <xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt;
    <xsl:output method='html' version='1.0' encoding='UTF-8' indent='yes'/>
    <xsl:template match="/">
    <html>
    <head></head>
    <body>
    <p>The Form elements are:</p>
    <ul>

    <xsl:apply-templates select="/AnnualInsuranceReturn/St1a/InsuranceContract/PremiumWritten"/>

    </ul>
    </body>
    </html>
    </xsl:template>

    <xsl:template match="/">
    <li><font color='yellow'><xsl:value-of select="@Four&quot;/></font></li>
    </xsl:template>

    </xsl:stylesheet>



    my xml looks like this


    <?xml version="1.0" encoding="UTF-8"?>
    <?xml-stylesheet type="text/xsl" href="AnnualInsuranceReturnMaximum.xsl"?>
    <AnnualInsuranceReturn xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot; xsi:noNamespaceSchemaLocation="\XML Schema\AnnualInsuranceSchema.xsd">
    <submissionDetails submissionCompany="ADRIATIC" submissionYear="1996"/>
    <St1A DirectlyThroughaBranch="Through a Branch" EUCountry="Austria">
    <InsuranceContract>
    <NumberofPolicies FIVE="12" FOUR="145" SIX="23" THREE="56" EIGHT="156" TEN="24" SEVEN="356" NINE="234" TWO="84"/>
    <NumberofInsured FIVE="12" FOUR="145" SIX="23" THREE="56" EIGHT="156" TEN="24" SEVEN="356" NINE="234" TWO="84"/>
    <PremiumWritten FIVE="12" FOUR="145" SIX="23" THREE="56" EIGHT="156" TEN="24" SEVEN="356" NINE="234" TWO="84"/>
    </InsuranceContract>
    <Claims>
    <NumberofOneoffClaims FIVE="12" FOUR="145" SIX="23" THREE="56" EIGHT="156" TEN="24" SEVEN="356" NINE="234" TWO="84"/>
    <NumberofInstallmentPaymentClaims FIVE="12" FOUR="145" SIX="23" THREE="56" EIGHT="156" TEN="24" SEVEN="356" NINE="234" TWO="84"/>
    <GrossClaimsPaidInOneOffAmount FIVE="12" FOUR="145" SIX="23" THREE="56" EIGHT="156" TEN="24" SEVEN="356" NINE="234" TWO="84"/>
    <GrossClaimsPaidIstallmentPayments FIVE="12" FOUR="145" SIX="23" THREE="56" EIGHT="156" TEN="24" SEVEN="356" NINE="234" TWO="84"/>
    </Claims>
    </St1A>
    <St1A DirectlyThroughaBranch="Through a Branch" EUCountry="Belgium">
    <InsuranceContract>
    <NumberofPolicies FIVE="12" FOUR="145" SIX="23" THREE="56" EIGHT="156" TEN="24" SEVEN="356" NINE="234" TWO="84"/>
    <NumberofInsured FIVE="12" FOUR="145" SIX="23" THREE="56" EIGHT="156" TEN="24" SEVEN="356" NINE="234" TWO="84"/>
    <PremiumWritten FIVE="12" FOUR="145" SIX="23" THREE="56" EIGHT="156" TEN="24" SEVEN="356" NINE="234" TWO="84"/>
    </InsuranceContract>
    <Claims>
    <NumberofOneoffClaims FIVE="12" FOUR="145" SIX="23" THREE="56" EIGHT="156" TEN="24" SEVEN="356" NINE="234" TWO="84"/>
    <NumberofInstallmentPaymentClaims FIVE="12" FOUR="145" SIX="23" THREE="56" EIGHT="156" TEN="24" SEVEN="356" NINE="234" TWO="84"/>
    <GrossClaimsPaidInOneOffAmount FIVE="12" FOUR="145" SIX="23" THREE="56" EIGHT="156" TEN="24" SEVEN="356" NINE="234" TWO="84"/>
    <GrossClaimsPaidIstallmentPayments FIVE="12" FOUR="145" SIX="23" THREE="56" EIGHT="156" TEN="24" SEVEN="356" NINE="234" TWO="84"/>
    </Claims>
    </St1A>


    etc....

    Thanks
    M


Comments

  • Registered Users Posts: 131 ✭✭theexis


    Issues are case sensitivity and a bogus match condition (bold). Revised xsl:
    <xsl:template match="/">
    
    <html>
    <head></head>
    <body>
    <p>The Form elements are:</p>
    <ul>
    	<xsl:apply-templates select="AnnualInsuranceReturn/[B]St1A[/B]/InsuranceContract/PremiumWritten"/>
    </ul>
    
    </body>
    </html>
    
    </xsl:template>
    
    <xsl:template match="[B]PremiumWritten[/B]">
    <li><font color='yellow'><xsl:value-of select="@[B]FOUR[/B]"/></font></li>
    </xsl:template>
    


  • Registered Users Posts: 5,102 ✭✭✭mathie


    Thanks thats perfect!
    M


Advertisement