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 6691721
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T05:47:06+00:00 2026-05-26T05:47:06+00:00

I got this XML document set up using some XSL and css to make

  • 0

I got this XML document set up using some XSL and css to make it look nice. I cannot get this foreach to work though and I’m not sure what I’m doing wrong. Anybody got any ideas?

XML

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="q3.xsl"?>
<expenseReport>
    <companyInfo>
        <name>John Doe</name>
        <email>jdoe@company.com</email>
        <empNum>1</empNum>
        <companyCode>10010011</companyCode>
    </companyInfo>
    <timeFrame>
        <costCenter />
        <startDate />
        <endDate />
    </timeFrame>
    <purpose />
    <technicalInfo>
        <date>9/9/09</date>
        <desc>heading to shanghai</desc>
        <miles>a lot</miles>
        <mileage amt="0.00">1.21</mileage>
        <airFare>7</airFare>
        <other>fish?</other>
        <meals>yes</meals>
        <conf>gesundheit</conf>
        <misc>champaign</misc>
        <code>red</code>
        <total price="0.00">107.00</total>
    </technicalInfo>
    <technicalInfo>
        <date>10/10/10</date>
        <desc>hawaii vacation</desc>
        <miles>a bunch</miles>
        <mileage amt="0.00">100.9</mileage>
        <airFare>1234.29</airFare>
        <other>nope</other>
        <meals>lobster dinner</meals>
        <conf>Still not sure what this is</conf>
        <misc>clubs</misc>
        <code>bluish green</code>
        <total price="0.00">3000.87</total>
    </technicalInfo>
    <technicalInfo>
        <date>11/11/11</date>
        <desc>Moving to Flordia</desc>
        <miles>not too many</miles>
        <mileage amt="0.00">12.3</mileage>
        <airFare />
        <other>Stopped at McDonalds</other>
        <meals>Big Mac and Fries</meals>
        <conf>No Idea</conf>
        <misc>Bought Gold Steering Wheel</misc>
        <code>clear</code>
        <total price="0.00">35.83</total>
    </technicalInfo>
</expenseReport>

XSL

<?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>
  <head>
    <title>Expense Report</title>
    <link type="text/css" rel="stylesheet" href="q3.css" />
  </head>
  <body>
    <div id="container">
        <h1>Expense Report</h1>
            <br />
        <table id="companyInfo" cellspacing="0px">
            <tr>
                <td>Name:</td>
                <td class="data"><xsl:value-of select="expenseReport/companyInfo/name"/></td>
            </tr>
            <tr>
                <td>Email:</td>
                <td class="data"><xsl:value-of select="expenseReport/companyInfo/email"/></td>
            </tr>
            <tr>
                <td>Employee Number:</td>
                <td class="data"><xsl:value-of select="expenseReport/companyInfo/empNum"/></td>
            </tr>
            <tr>
                <td>Company Number:</td>
                <td class="data"><xsl:value-of select="expenseReport/companyInfo/companyCode"/></td>
            </tr>
        </table>
        <table id="timeFrame" cellspacing="0px">
            <tr>
                <td>Cost Center: </td>
                <td><xsl:value-of select="expenseReport/timeFrame/costCenter"/></td>
            </tr>
            <tr>
                <td>Start Date: </td>
                <td><xsl:value-of select="expenseReport/timeFrame/startDate"/></td>
            </tr>
            <tr>
                <td>End Date:</td>
                <td><xsl:value-of select="expenseReport/timeFrame/endDate"/></td>
            </tr>
        </table>
        <table id="purpose" cellspacing="0px">
            <tr>
                <td>
                    Purpose:
                </td>
                <td width="700px">
                    <xsl:value-of select="expenseReport/purpose"/>
                </td>
            </tr>
        </table>
            <br />
            <br />
        <table id="techInfo" cellspacing="0px" width="900px">
            <tr>
                <th>Date</th>
                <th>Description</th>
                <th>Miles</th>
                <th>Milage</th>
                <th>Airfare</th>
                <th>Other</th>
                <th>Meals</th>
                <th>Conf.</th>
                <th>Misc</th>
                <th>Code</th>
                <th>Total</th>
            </tr>
            <xsl:for-each select="expenseReport/technicalInfo">
            <tr>

                    <td><xsl:value-of select="expenseReport/technicalInfo/date"/></td>
                    <td><xsl:value-of select="expenseReport/technicalInfo/desc"/></td>
                    <td><xsl:value-of select="expenseReport/technicalInfo/miles"/></td>
                    <td><xsl:value-of select="expenseReport/technicalInfo/milage"/></td>
                    <td><xsl:value-of select="expenseReport/technicalInfo/airfare"/></td>
                    <td><xsl:value-of select="expenseReport/technicalInfo/other"/></td>
                    <td><xsl:value-of select="expenseReport/technicalInfo/meals"/></td>
                    <td><xsl:value-of select="expenseReport/technicalInfo/conf"/></td>
                    <td><xsl:value-of select="expenseReport/technicalInfo/misc"/></td>
                    <td><xsl:value-of select="expenseReport/technicalInfo/code"/></td>
                    <td><xsl:value-of select="expenseReport/technicalInfo/total"/></td>
            </tr>
            </xsl:for-each>
        </table>
    </div>
  </body>
  </html>
</xsl:template>
</xsl:stylesheet>

It’s showing it up as blank data. Maybe I’m not sure how this foreach works.

  • 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-05-26T05:47:07+00:00Added an answer on May 26, 2026 at 5:47 am

    Your xsl:for-each already matches the expenseReport/technicalInfo nodes, therfore inside the loop you need only match the current node as such:

    <xsl:for-each select="expenseReport/technicalInfo">
      <tr>
    
        <td>
          <xsl:value-of select="date"/>
        </td>
        <td>
          <xsl:value-of select="desc"/>
        </td>
        <td>
          <xsl:value-of select="miles"/>
        </td>
        <td>
          <xsl:value-of select="milage"/>
        </td>
        <td>
          <xsl:value-of select="airfare"/>
        </td>
        <td>
          <xsl:value-of select="other"/>
        </td>
        <td>
          <xsl:value-of select="meals"/>
        </td>
        <td>
          <xsl:value-of select="conf"/>
        </td>
        <td>
          <xsl:value-of select="misc"/>
        </td>
        <td>
          <xsl:value-of select="code"/>
        </td>
        <td>
          <xsl:value-of select="total"/>
        </td>
      </tr>
    </xsl:for-each>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We're parsing an XML document using JAXB and get this error: [org.xml.sax.SAXParseException: Invalid byte
I've got an XML file with XSL, and CSS layers. When I view this
I have got an XML document which looks something like this. <Root> <Info>....</Info> <Info>....</Info>
I've got some XML, for example purposes it looks like this: <root> <field1>test</field1> <f2>t2</f2>
I've got a XML document looking like this: <Xmlpp Version=0.3><meta><Id>123456789</Id></meta></Xmlpp> And this is how
I got a XML-document with several values, this is part of it: <result> <element>
I've got an XML document with a default namespace. I'm using a XPathNavigator to
Let's say that I've got this xml: <items> <item name=thumb> <downloadStream>test1</downloadStream> <downloadStream>test2</downloadStream> <downloadStream>test3</downloadStream> </item>
I got this weird error when I wanted to validate my in-memory xml Schema,
I got this far: :~ curl -u username:password -d status=new_status http://twitter.com/statuses/update.xml Now, how can

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.