TimTucker Posted June 8, 2004 Posted June 8, 2004 I have a large number of items like this: <row> <class>TYPE A</class> <field1>foo1</field1> <field2>bar1</field2> </row> <row> <class>TYPE A</class> <field1>foo2</field1> <field2>bar2</field2> </row> <row> <class>TYPE B</class> <field1>foo3</field1> <field2>bar3</field2> </row> I'd like to separate out all the "class" fields and come up with something like this: <class name="TYPE A"> <row> <field1>foo1</field1> <field2>bar1</field2> </row> <row> <field1>foo2</field1> <field2>bar2</field2> </row> </class> <class name="TYPE B"> <row> <field1>foo3</field1> <field2>bar3</field2> </row> </class> Although the end result is that I'd like to produce a large number of HTML tables that look something like this: TYPE A: field 1: field2: foo1 bar1 foo2 bar2 TYPE B: field 1: field2: foo3 bar3
TimTucker Posted June 8, 2004 Author Posted June 8, 2004 Nevermind, I think I figured it out. This seems to do what I wanted. The key was finding out how to find unique values for "class": <xsl:for-each select="//fmp:Class[not(.=preceding::fmp:Class)]"> <p><b><xsl:value-of select="."/></b></p> <table border="1"> <tr> <th align="left">Field 1:</th> <th align="left">Field 2:</th> </tr> <xsl:for-each select="//fmp:Class[.=current()]/parent::*"> <tr> <xsl:choose> <xsl:when test="position() mod 2 = 1"> <xsl:attribute name="class">clsOdd</xsl:attribute> </xsl:when> <xsl:otherwise> <xsl:attribute name="class">clsEven</xsl:attribute> </xsl:otherwise> </xsl:choose> <xsl:for-each select="fmp:Class/following-sibling::*"> <td><xsl:value-of select="."/></td> </xsl:for-each> </tr> </xsl:for-each> </table> <hr/> </xsl:for-each>
Newbies it4yeshau Posted June 18, 2004 Newbies Posted June 18, 2004 Hi Tim, I'm trying to use a xslt style sheet with an xml export from FM version 6. The format I exported is FMPDSORESULT. Whenever I try to do anything with the xml file, it won't work correctly. A match would not be found if I use FMPDSORESULT as a match or anything like "//ROW". To debug the problem, I exported without using a xsl style sheet. I used a program called oxygen to edit and parse the files. I had a hunch: the FMPDSORESULT element has an attribute xmlsn="http://www.filemaker.com/fmpdsoresult" so I renamed the attribute name and it worked. How can I get this to work? Thanks! -Jordan
Recommended Posts
This topic is 7461 days old. Please don't post here. Open a new topic instead.
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 accountSign in
Already have an account? Sign in here.
Sign In Now