Jump to content

new to XML/XSL


Recommended Posts

Ok, I'm new to XML and XSL. Ultimately I want to populate this table with filters based on user input but thought I'd start with the whole table.

 

Here's a portion of my XML file

 

<?xml version="1.0" encoding="UTF-8" standalone="yes"?><?xml-stylesheet type="text/xsl" href="XSLstylesheet.xsl"?><data-set> <rep> <RepID>12345</RepID> <Rep>SomeName</Rep> <Dept>PS</Dept> <Station>1</Station> <ClassDate>41593</ClassDate> <Agency>AGency</Agency> <EmAppr>y</EmAppr> </rep> <rep> <RepID>98765</RepID> <Rep>Another Name</Rep> <Dept>HC</Dept> <Station>2</Station> <ClassDate>41593</ClassDate> <Agency>Next Agency</Agency> <EmAppr>y</EmAppr> </rep>

 

...

</rep></data-set>

 

Here's my XSL:

<?xml version="1.0" encoding="UTF-8"?><xsl:stylesheet version="1.0"xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:template match="/"> <html> <body> <h2>Representatives</h2> <table border="1"> <tr bgcolor="#9acd32"> <th>Rep</th> <th>Rep ID</th> <th>Department</th> <th>Station</th> <th>Start Date</th> <th>Agency</th> <th>Out of Approval Queue</th> </tr> <xsl:for-each select="data-set/rep"> <tr> <td><xsl:value-of select="data-set/Rep"/></td> <td><xsl:value-of select="data-set/RepID"/></td> <td><xsl:value-of select="data-set/Dept"/></td> <td><xsl:value-of select="data-set/Station"/></td> <td><xsl:value-of select="data-set/ClassDate"/></td> <td><xsl:value-of select="data-set/Agency"/></td> <td><xsl:value-of select="data-set/EmAppr"/></td> </tr> </xsl:for-each> </table> </body> </html></xsl:template></xsl:stylesheet>

 

When I run it, the table has the requesite rows but no data in the cells. ???? What did I do wrong?

Link to post
Share on other sites
  • 2 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...