June 8, 200421 yr 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
June 8, 200421 yr Author 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>
June 18, 200421 yr Newbies 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
Create an account or sign in to comment