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

  • Home
  • SEARCH
  • 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 8601391
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T01:49:50+00:00 2026-06-12T01:49:50+00:00

I am new to XSLT so pardon me if my code is terrible. I

  • 0

I am new to XSLT so pardon me if my code is terrible. I would like to have a table in HTML with the episode details repeated for every daily intervention. At the momemt with my code I dont even have a table. I have looked for ways to do this but with no avail

My XML

<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="example_XMLTransformationFile.xsl"?>
<ClientImport xmlns:xsi="http://www.w3.org/2001/XMLSchema">
<episode localID="P333456">
    <episodeDetails>
        <caseNo>0000000</caseNo>
        <address1>where Person1 live</address1>
        <address4>Do they live there</address4>
        <postcode>PP1 2PP</postcode>
        <familyName>Person1</familyName>
        <firstName>PersonF1</firstName>
        <dobEst>0</dobEst>
    </episodeDetails>
    <dailyInterventions>
    <dailyIntervention>
        <activityDate>2012-08-23</activityDate>
        <ecg>true</ecg>
        <cpox>true</cpox>
        <invVentET>true</invVentET>
        <invVentTT>false</invVentTT>
    </dailyIntervention>
    <dailyIntervention>
        <activityDate>2012-08-24</activityDate>
        <ecg>true</ecg>
        <cpox>true</cpox>
        <invVentET>true</invVentET>
        <invVentTT>false</invVentTT>
    </dailyIntervention>
    <dailyIntervention>
        <activityDate>2012-08-25</activityDate>
        <ecg>true</ecg>
        <cpox>true</cpox>
        <invVentET>false</invVentET>
        <invVentTT>false</invVentTT>
    </dailyIntervention>
    <dailyIntervention>
        <activityDate>2012-08-26</activityDate>
        <ecg>true</ecg>
        <cpox>true</cpox>
        <invVentET>true</invVentET>
        <invVentTT>false</invVentTT>
    </dailyIntervention>
    <dailyIntervention>
        <activityDate>2012-08-27</activityDate>
        <ecg>true</ecg>
        <cpox>true</cpox>
        <invVentET>true</invVentET>
        <invVentTT>false</invVentTT>
    </dailyIntervention>
    <dailyIntervention>
        <activityDate>2012-08-28</activityDate>
        <ecg>true</ecg>
        <cpox>true</cpox>
        <invVentET>true</invVentET>
        <invVentTT>false</invVentTT>
    </dailyIntervention>
    <dailyIntervention>
        <activityDate>2012-08-29</activityDate>
        <ecg>true</ecg>
        <cpox>true</cpox>
        <invVentET>true</invVentET>
        <invVentTT>false</invVentTT>
    </dailyIntervention>
    <dailyIntervention>
        <activityDate>2012-08-30</activityDate>
        <ecg>true</ecg>
        <cpox>true</cpox>
        <invVentET>false</invVentET>
        <invVentTT>false</invVentTT>
    </dailyIntervention>
    <dailyIntervention>
        <activityDate>2012-08-31</activityDate>
        <ecg>true</ecg>
        <cpox>true</cpox>
        <invVentET>false</invVentET>
        <invVentTT>false</invVentTT>
    </dailyIntervention>
    </dailyInterventions>
</episode>
<episode localID="20120410">
    <episodeDetails>
        <caseNo>0000001</caseNo>
        <address1>where Person2 Lives</address1>
        <address4>Street Person2</address4>
        <postcode>XX1 1XX</postcode>
        <familyName>Person2</familyName>
        <firstName>Person2 A</firstName>
        <dobEst>0</dobEst>
    </episodeDetails>
    <dailyInterventions>
    <dailyIntervention>
        <activityDate>2012-08-23</activityDate>
        <noCrit>true</noCrit>
    </dailyIntervention>
    </dailyInterventions>
</episode>
<episode localID="20120411">
<episodeDetails>
    <caseNo>0000002</caseNo>
    <address1>Where Person3 Lives</address1>
    <address4>Person 3 Street</address4>
    <postcode>WW1 1WW</postcode>
    <familyName>Person3</familyName>
    <firstName>Person 3 B</firstName>
    <dobEst>0</dobEst>
</episodeDetails>
<dailyInterventions>
<dailyIntervention>
    <activityDate>2012-08-24</activityDate>
    <ecg>true</ecg>
    <cpox>true</cpox>
    <invVentET>true</invVentET>
    <invVentTT>false</invVentTT>
</dailyIntervention>
<dailyIntervention>
    <activityDate>2012-08-25</activityDate>
    <ecg>true</ecg>
    <cpox>true</cpox>
    <invVentET>true</invVentET>
    <invVentTT>false</invVentTT>
</dailyIntervention>
<dailyIntervention>
    <activityDate>2012-08-26</activityDate>
    <ecg>true</ecg>
    <cpox>true</cpox>
    <invVentET>true</invVentET>
    <invVentTT>false</invVentTT>
</dailyIntervention>
<dailyIntervention>
    <activityDate>2012-08-27</activityDate>
    <ecg>true</ecg>
    <cpox>true</cpox>
    <invVentET>false</invVentET>
    <invVentTT>false</invVentTT>
</dailyIntervention>
<dailyIntervention>
    <activityDate>2012-08-28</activityDate>
    <ecg>true</ecg>
    <cpox>true</cpox>
    <invVentET>false</invVentET>
    <invVentTT>false</invVentTT>
</dailyIntervention>
<dailyIntervention>
    <activityDate>2012-08-29</activityDate>
    <ecg>true</ecg>
    <cpox>true</cpox>
    <invVentET>false</invVentET>
    <invVentTT>false</invVentTT>
</dailyIntervention>
</dailyInterventions>
</episode>
<episode localID="20120418">
<episodeDetails>
    <caseNo>000004</caseNo>
    <address1>where person4 lives</address1>
    <address4>Person4 Road</address4>
    <postcode>NN1 1NN</postcode>
    <familyName>Person4</familyName>
    <firstName>Person4 B</firstName>
    <dobEst>0</dobEst>
</episodeDetails>
<dailyInterventions>
<dailyIntervention>
    <activityDate>2012-08-24</activityDate>
    <ecg>true</ecg>
    <cpox>true</cpox>
    <invVentET>false</invVentET>
    <invVentTT>false</invVentTT>
</dailyIntervention>
</dailyInterventions>
</episode>
<episode localID="20120419">
<episodeDetails>
    <caseNo>0000005</caseNo>
    <address1>Where Person5 Lives</address1>
    <address4>Person5 Road</address4>
    <postcode>SS1 1SS</postcode>
    <familyName>Person5</familyName>
    <firstName>Person5 K</firstName>
    <dobEst>0</dobEst>
</episodeDetails>
<dailyInterventions>
<dailyIntervention>
    <activityDate>2012-08-25</activityDate>
    <ecg>true</ecg>
    <cpox>true</cpox>
    <invVentET>false</invVentET>
    <invVentTT>false</invVentTT>
</dailyIntervention>
<dailyIntervention>
    <activityDate>2012-08-26</activityDate>
    <ecg>true</ecg>
    <cpox>true</cpox>
    <invVentET>false</invVentET>
    <invVentTT>false</invVentTT>
</dailyIntervention>
<dailyIntervention>
    <activityDate>2012-08-27</activityDate>
    <ecg>true</ecg>
    <cpox>true</cpox>
    <invVentET>false</invVentET>
    <invVentTT>false</invVentTT>
</dailyIntervention>
<dailyIntervention>
    <activityDate>2012-08-28</activityDate>
    <ecg>true</ecg>
    <cpox>true</cpox>
    <invVentET>false</invVentET>
    <invVentTT>false</invVentTT>
</dailyIntervention>
<dailyIntervention>
    <activityDate>2012-08-29</activityDate>
    <ecg>true</ecg>
    <cpox>true</cpox>
    <invVentET>false</invVentET>
    <invVentTT>false</invVentTT>
</dailyIntervention>
<dailyIntervention>
    <activityDate>2012-08-30</activityDate>
    <ecg>true</ecg>
    <cpox>true</cpox>
    <invVentET>false</invVentET>
    <invVentTT>false</invVentTT>
</dailyIntervention>
<dailyIntervention>
    <activityDate>2012-08-31</activityDate>
    <ecg>true</ecg>
    <cpox>true</cpox>
    <invVentET>false</invVentET>
    <invVentTT>false</invVentTT>
</dailyIntervention>
<dailyIntervention>
    <activityDate>2012-09-01</activityDate>
    <ecg>true</ecg>
    <cpox>true</cpox>
    <invVentET>false</invVentET>
    <invVentTT>false</invVentTT>
</dailyIntervention>
<dailyIntervention>
    <activityDate>2012-09-02</activityDate>
    <ecg>true</ecg>
    <cpox>true</cpox>
    <invVentET>false</invVentET>
    <invVentTT>false</invVentTT>
</dailyIntervention>
<dailyIntervention>
    <activityDate>2012-09-03</activityDate>
    <ecg>true</ecg>
    <cpox>true</cpox>
    <invVentET>false</invVentET>
    <invVentTT>false</invVentTT>
</dailyIntervention>
</dailyInterventions>
</episode>
<episode localID="20120420">
<episodeDetails>
    <caseNo>0000006</caseNo>
    <address1>Where person6 Lives</address1>
    <address4>Person6 Road</address4>
    <postcode>EE1 EE1</postcode>
    <familyName>Person6</familyName>
    <firstName>Person6 N</firstName>
    <dobEst>0</dobEst>
</episodeDetails>
<dailyInterventions>
<dailyIntervention>
    <activityDate>2012-08-23</activityDate>
    <ecg>true</ecg>
    <cpox>true</cpox>
    <invVentET>false</invVentET>
    <invVentTT>false</invVentTT>
</dailyIntervention>
<dailyIntervention>
    <activityDate>2012-08-24</activityDate>
    <ecg>true</ecg>
    <cpox>true</cpox>
    <invVentET>false</invVentET>
    <invVentTT>false</invVentTT>
</dailyIntervention>
<dailyIntervention>
    <activityDate>2012-08-25</activityDate>
    <ecg>true</ecg>
    <cpox>true</cpox>
    <invVentET>false</invVentET>
    <invVentTT>false</invVentTT>
</dailyIntervention>
<dailyIntervention>
    <activityDate>2012-08-26</activityDate>
    <ecg>true</ecg>
    <cpox>true</cpox>
    <invVentET>false</invVentET>
    <invVentTT>false</invVentTT>
</dailyIntervention>
<dailyIntervention>
    <activityDate>2012-08-27</activityDate>
    <ecg>true</ecg>
    <cpox>true</cpox>
    <invVentET>false</invVentET>
    <invVentTT>false</invVentTT>
</dailyIntervention>
</dailyInterventions>
</episode>

My XSLT

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:template match="/">     
        <html>    
            <xsl:apply-templates select="ClientImport"/>       
        </html> 
    </xsl:template> 
    <xsl:template match="ClientImport">     
        <table border="1">
        <tr>
            <th>LOCALID</th>
            <th>CASENO</th>
            <th>ADDRESS1</th>
            <th>ADDRESS4</th>
            <th>POSTCODE</th>
            <th>FAMILYNAME</th>
            <th>FIRSTNAME</th>
            <th>DOBEST</th>
            <th>ACTIVITYDATE</th>
            <th>ECG</th>
            <th>CPOX</th>
            <th>INVVENTET</th>
            <th>INVVENTTT</th>
        </tr>
        <xsl:apply-templates select="episode"/>                 
    </table>         
</xsl:template>
<xsl:template match="episode"> 
    <tr>
        <td><xsl:value-of select="@localID"/></td> 
        <xsl:apply-templates select="dailyInterventions/dailyIntervention"/> 
    </tr>       
</xsl:template>
<xsl:template match="episodeDetails">       
        <td><xsl:value-of select="caseNo"/></td>
        <td><xsl:value-of select="address1"/></td>
        <td><xsl:value-of select="address4"/></td>
        <td><xsl:value-of select="postcode"/></td>
        <td><xsl:value-of select="familyName"/></td>
        <td><xsl:value-of select="firstName"/></td>
        <td><xsl:value-of select="dobEst"/></td>
</xsl:template>
<xsl:template match="dailyInterventions/dailyIntervention"> 
    <xsl:apply-templates select="episodeDetails"> 
    <xsl:for-each select="dailyInterventions/dailyIntervention">
    <tr>

    <td><xsl:value-of select="activityDate"/></td>
    <td><xsl:value-of select="ecg"/></td>
    <td><xsl:value-of select="cpox"/></td>
    <td><xsl:value-of select="invVentET"/></td>
    <td><xsl:value-of select="invVentTT"/></td>
    </tr>
</xsl:for-each>
</xsl:template>

Desired Output

localID caseNo  address1    address4    postcode    familyName  firstName   dobEst  activityDate    ecg cpox    invVentET   invVentTT   noCrit
P333456 0   where Person1 live  Do they live there  PP1 2PP Person1 PersonF1    0   23/08/2012  TRUE    TRUE    TRUE    FALSE   
P333456 0   where Person1 live  Do they live there  PP1 2PP Person1 PersonF1    0   24/08/2012  TRUE    TRUE    TRUE    FALSE   
P333456 0   where Person1 live  Do they live there  PP1 2PP Person1 PersonF1    0   25/08/2012  TRUE    TRUE    FALSE   FALSE   
P333456 0   where Person1 live  Do they live there  PP1 2PP Person1 PersonF1    0   26/08/2012  TRUE    TRUE    TRUE    FALSE   
P333456 0   where Person1 live  Do they live there  PP1 2PP Person1 PersonF1    0   27/08/2012  TRUE    TRUE    TRUE    FALSE   
P333456 0   where Person1 live  Do they live there  PP1 2PP Person1 PersonF1    0   28/08/2012  TRUE    TRUE    TRUE    FALSE   
P333456 0   where Person1 live  Do they live there  PP1 2PP Person1 PersonF1    0   29/08/2012  TRUE    TRUE    TRUE    FALSE   
P333456 0   where Person1 live  Do they live there  PP1 2PP Person1 PersonF1    0   30/08/2012  TRUE    TRUE    FALSE   FALSE   
P333456 0   where Person1 live  Do they live there  PP1 2PP Person1 PersonF1    0   31/08/2012  TRUE    TRUE    FALSE   FALSE   
20120410    1   where Person2 Lives Street Person2  XX1 1XX Person2 Person2 A   0   23/08/2012                  TRUE
20120411    2   Where Person3 Lives Person 3 Street WW1 1WW Person3 Person 3 B  0   24/08/2012  TRUE    TRUE    TRUE    FALSE   
20120411    2   Where Person3 Lives Person 3 Street WW1 1WW Person3 Person 3 B  0   25/08/2012  TRUE    TRUE    TRUE    FALSE   
20120411    2   Where Person3 Lives Person 3 Street WW1 1WW Person3 Person 3 B  0   26/08/2012  TRUE    TRUE    TRUE    FALSE   
20120411    2   Where Person3 Lives Person 3 Street WW1 1WW Person3 Person 3 B  0   27/08/2012  TRUE    TRUE    FALSE   FALSE   
20120411    2   Where Person3 Lives Person 3 Street WW1 1WW Person3 Person 3 B  0   28/08/2012  TRUE    TRUE    FALSE   FALSE   
20120411    2   Where Person3 Lives Person 3 Street WW1 1WW Person3 Person 3 B  0   29/08/2012  TRUE    TRUE    FALSE   FALSE   
20120418    4   where person4 lives Person4 Road    NN1 1NN Person4 Person4 B   0   24/08/2012  TRUE    TRUE    FALSE   FALSE   
20120419    5   Where Person5 Lives Person5 Road    SS1 1SS Person5 Person5 K   0   25/08/2012  TRUE    TRUE    FALSE   FALSE   
20120419    5   Where Person5 Lives Person5 Road    SS1 1SS Person5 Person5 K   0   26/08/2012  TRUE    TRUE    FALSE   FALSE   
20120419    5   Where Person5 Lives Person5 Road    SS1 1SS Person5 Person5 K   0   27/08/2012  TRUE    TRUE    FALSE   FALSE   
20120419    5   Where Person5 Lives Person5 Road    SS1 1SS Person5 Person5 K   0   28/08/2012  TRUE    TRUE    FALSE   FALSE   
20120419    5   Where Person5 Lives Person5 Road    SS1 1SS Person5 Person5 K   0   29/08/2012  TRUE    TRUE    FALSE   FALSE   
20120419    5   Where Person5 Lives Person5 Road    SS1 1SS Person5 Person5 K   0   30/08/2012  TRUE    TRUE    FALSE   FALSE   
20120419    5   Where Person5 Lives Person5 Road    SS1 1SS Person5 Person5 K   0   31/08/2012  TRUE    TRUE    FALSE   FALSE   
20120419    5   Where Person5 Lives Person5 Road    SS1 1SS Person5 Person5 K   0   01/09/2012  TRUE    TRUE    FALSE   FALSE   
20120419    5   Where Person5 Lives Person5 Road    SS1 1SS Person5 Person5 K   0   02/09/2012  TRUE    TRUE    FALSE   FALSE   
20120419    5   Where Person5 Lives Person5 Road    SS1 1SS Person5 Person5 K   0   03/09/2012  TRUE    TRUE    FALSE   FALSE   
20120420    6   Where person6 Lives Person6 Road    EE1 EE1 Person6 Person6 N   0   23/08/2012  TRUE    TRUE    FALSE   FALSE   
20120420    6   Where person6 Lives Person6 Road    EE1 EE1 Person6 Person6 N   0   24/08/2012  TRUE    TRUE    FALSE   FALSE   
20120420    6   Where person6 Lives Person6 Road    EE1 EE1 Person6 Person6 N   0   25/08/2012  TRUE    TRUE    FALSE   FALSE   
20120420    6   Where person6 Lives Person6 Road    EE1 EE1 Person6 Person6 N   0   26/08/2012  TRUE    TRUE    FALSE   FALSE   
20120420    6   Where person6 Lives Person6 Road    EE1 EE1 Person6 Person6 N   0   27/08/2012  TRUE    TRUE    FALSE   FALSE   
  • 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-12T01:49:51+00:00Added an answer on June 12, 2026 at 1:49 am

    The following stylesheet produces what I believe the desired output is:

    <?xml version="1.0" encoding="ISO-8859-1"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    
        <xsl:variable name="lower" select="'abcdefghijklmnopqrstuvwyzy'"/>
        <xsl:variable name="upper" select="'ABCDEFGHIJKLMNOPQRSTUVWYZY'"/>
    
        <xsl:template match="/">     
            <html>    
                <xsl:apply-templates select="ClientImport"/>       
            </html> 
        </xsl:template> 
    
        <xsl:template match="ClientImport">     
            <table border="1">
                <tr>
                    <xsl:apply-templates select="episode[1]/@localID" mode="header"/>
                    <xsl:apply-templates select="episode[1]/episodeDetails[1]/*" mode="header"/>
                    <xsl:apply-templates select="episode[1]/dailyInterventions[1]/dailyIntervention[1]/*" mode="header"/>
                </tr>
                <xsl:apply-templates select="episode"/>                 
            </table>         
        </xsl:template>
    
        <xsl:template match="@*|*" mode="header">
            <th><xsl:value-of select="translate(local-name(), $lower, $upper)"/></th>
        </xsl:template>
    
        <xsl:template match="episode"> 
            <xsl:apply-templates select="dailyInterventions/dailyIntervention"/>
        </xsl:template>
    
        <xsl:template match="@localID">
            <td><xsl:value-of select="."/></td> 
        </xsl:template>
    
        <xsl:template match="episodeDetails">
            <xsl:apply-templates select="../@localID"/>
            <xsl:apply-templates select="*"/>
        </xsl:template>
    
        <xsl:template match="dailyInterventions/dailyIntervention"> 
            <tr>
                <xsl:apply-templates select="../preceding-sibling::episodeDetails" />
                <xsl:apply-templates select="*"/>
            </tr>     
        </xsl:template>
    
        <xsl:template match="episodeDetails/* | dailyIntervention/*">
            <td><xsl:value-of select="."/></td>
        </xsl:template>
    
    </xsl:stylesheet>
    

    I changed some of the boiler-plate hard-coded items to use xsl:apply-templates.

    For instance, to generate the headers it applies templates for the attribute and elements in a mode that creates the <th> and outputs the upper-case name of the item.

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

Sidebar

Related Questions

i am pretty new to XSLT / XML and HTML. I have a XML
I'm new at XSLT, and I would like to know if there is a
I am new in xslt. I have the following problem. I need within an
I am relatively new to xslt, but I have had some luck styling a
I am new to XSLT and have spent hours trying to figure out a
I am new to XSLT, please help. We have an XML which we want
I am new to XSLT and have a similar requirement to Line Break in
I am new to XSLT and have a problem with removing duplicate entries from
I'm quite new to xslt I have the following xslt snippet (pseudo'ed for clarity):
I am new to XSLT Transformation world. I'm using XSLT to create an HTML

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.