xsl import - selecting rows by rowset id
Greetings
i´m trying to import some online cached xml sheets into a filemaker database via xsl
XML scheme:
<node1>
<node2>
<rowset name=rowsetname1>
<row id=1 > // various attribs in here are safed into first table // primarykey = id // second table should get this, too
<rowset>
<row attrib1=x attrib2=y/> // all attribs in these rows should be safed in second table also refered by id from above so: id + attribs from one row = 1 DS in table
<row attrib1=k attrib2=f/>
<row attrib1=h attrib2=d/>
</rowset>
</row>
<row id=2>
<rowset>
<row attrib1=x attrib2=y/>
<row attrib1=k attrib2=f/>
<row attrib1=h attrib2=d/>
</rowset>
</row>
<row id=3>
<rowset>
<row attrib1=x attrib2=y/>
<row attrib1=k attrib2=f/>
<row attrib1=h attrib2=d/>
</rowset>
</row>
</rowset>
<rowset name=rowsetthatgetsnotselected>
...
</rowset>
</node2>
</node1>
currently my attemp to this is (as im new to xsl):
fields in the table the data is imported to: ID | ATTRIB1 | ATTRIB2 | ...
XSL (current attemp - table remains empty after import:
//get rowset by name
<RESULTSET FOUND="">
<xsl:for-each select="node1/node2/rowset[@name='rowsetnamedenichbrauche']/row">">
<ROW MODID="0" xmlns="http://www.filemaker.com/fmpxmlresult">
// get attribute id into var - loop through rows
<xsl:for-each select="@id">
<xsl:variable name="var_id" select="." />
// as soon as var_id contains a value (and bevore looping to the next row) select only the child rows of the row where id=var_id
<xsl:choose>
<xsl:when test="self::node()[@id='$var_id']">
// and import every attribute in the rows into its ds in the table
<xsl:for-each select="self::node()/rowset/row">">
<ROW MODID="0" xmlns="http://www.filemaker.com/fmpxmlresult">
<xsl:for-each select="@*">
// bevore the attribut values are passed the var_id value should be imported so the ds gets the desired format (id, attrib1, attrib2, ...)
???????
<COL><DATA><xsl:value-of select="."/></DATA></COL>
</xsl:for-each>
</ROW>
</xsl:for-each>
</xsl:when>
</xsl:choose>
</xsl:for-each>
</ROW>
</xsl:for-each>
</RESULTSET>
thank you very much for any suggestions
|