Jump to content

new to XML/XSL


Rominall

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 comment
Share on other sites

  • 2 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...