[Home] [By Thread] [By Date] [Recent Entries]
Hi Richard,
I can't see your real intention, but mybe my suggestions can help. While I think the approach should be changed, I can't really improve it, only more or less fix your code. RShonk@xxxxxxxxxxxxx wrote: Quick background: I am merging 4 xml documents into a PDF doc using xsl-fo and xslt. I have one xml document containg filenames. XML file 1 contains header information. XML file 2 contains addresses and the XML file 3 contains detail items. What I want to do is loop through all the header records. On each header select a matching address from file3 using an account number element value from file 1 and then select multiple detail records from file 2 using an id element value from file 1. My problem is 2 fold 1) the xml files returned from the database share the same top level elements <ROWSET> and <ROW> and the key elements have the same name in both files, <ACCOUNT> and <SHIPID> so can I differentiate file1.rowset.row from file2.rowset.row in my template match values? 2) The key is defined before the file variables so what can I use as a match value. In XSLT there are modes possible, so that you can process a node multiple times or write templates for one node name in different modes. <xsl:apply-templates select="$headers/ROWSET/ROW" mode="header"/> </xsl:template> You can't use a variable in template match, it's forbidden in XSLT. But you can also add the mode attribute here. <xsl:template match="ROW" mode="header"> <xsl:apply-templates/> </xsl:template> <xsl:template match="ROW" mode="account"> <xsl:value-of select="D"/> <xsl:value-of select="E"/> </xsl:template> Hmm, hope this helps a bit. Regards, Joerg XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|

Cart



