Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

XSLT question

  • 16-09-2005 03:15PM
    #1
    Registered Users, Registered Users 2 Posts: 5,103 ✭✭✭


    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, Registered Users 2 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, Registered Users 2 Posts: 5,103 ✭✭✭mathie


    Thanks thats perfect!
    M


Advertisement