At 2004-01-19 18:31 +0000, Paul Spence wrote:
Is there any way I can use keys when calling on external XML files using
the document function?
Key tables only have document-wide scope.
I am trying to use the Muenchian grouping
technique to list unique content values for an element, but the values
exist in a document that is external to the one I'm processing.
The technique uses generate-id() which is unique for all nodes in the set
of source node trees, thus you'll never equate the node from one tree to
the node in another tree by using generate-id().
More detail below (apologies for long post):
Not enough, though, to work with for a working example.
-----------------XSLT FILE--------------
<xsl:key name="myKeyName" match="document('master_primary.xml')//rs"
use="normalize-space(.)" />
<xsl:template match="divGen">
<xsl:if test="@id='personIndex'">
<xsl:for-each
select="document('../../xml/02_master/master_object.xml')//rs[generate-i
d(.)=generate-id(key('myKeyName',
normalize-space(.))[1])][(_at_)type='person']">
The above test will *always* produce an empty set: the generated
identifiers for nodes in master_primary.xml (in your key table) will never
equal any of the generated identifiers in your master_object.xml files.
I can think of other methods, using intermediate XML output, but would
prefer to avoid them if possible.
You might be stuck doing so ... grouping techniques employ node identity,
not node equality, and your nodes are from different documents.
I hope this helps.
.......................... Ken
--
North America (Washington, DC): 3-day XSLT/2-day XSL-FO 2004-03-15
- (San Francisco, CA): 3-day XSLT/2-day XSL-FO 2004-03-22
Asia (Hong Kong, China): 3-day XSLT/2-day XSL-FO 2004-05-17
Europe (Bremen, Germany): 3-day XSLT/2-day XSL-FO 2004-05-24
Instructor-led on-site corporate, government & user group training
for XSLT and XSL-FO world-wide: please contact us for the details
G. Ken Holman mailto:gkholman(_at_)CraneSoftwrights(_dot_)com
Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/
Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995)
Male Breast Cancer Awareness http://www.CraneSoftwrights.com/s/bc
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list