Re: Identical entries in different input documents sho
I have the following problem. I have a couple of XML documents to merge to one output document. Each document has the same structure like this:
Mike is correct that the variable-based grouping method would work with this, but it is far slower than an XSLT 2 approach. When using XSLT 1.0 I find variable-based grouping acceptable for sub-document and multi-document grouping.
The code would work along the lines of the following, and it assumes that there is an XML structure $files with the list of all the file names:
<xsl:variable name="items" select="document($files/file/@uri,.)/root/block"/> <xsl:for-each select="$items"> <!--walk through all, doing work at first of each unique idTag--> <xsl:if test="generate-id(.)= generate-id($items[idTag=current()/idTag])"> <!--the following executes once for each unique idTag value across all the files--> </xsl:if> </xsl:for-each>
I hope this helps.
. . . . . . . . . . . . . Ken
-- Upcoming public training: XSLT/XSL-FO Sep 10, UBL/code lists Oct 1 World-wide corporate, govt. & user group XML, XSL and UBL training RSS feeds: publicly-available developer resources and training G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995) Male Cancer Awareness Jul'07 http://www.CraneSoftwrights.com/s/bc Legal business disclaimers: http://www.CraneSoftwrights.com/legal
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format