Glen Mazza wrote:
The only problem is that if Chris has [1] and [6] as
documents, he will still be shown because he has one
document ([1]) that matches. Only if Chris has *no*
matches at all was I trying to get this name to be
displayed.
Aha, I see. I misunderstood that demand. I thought the requirement was
"if one or more @rel-id were not found". Here are two options that work
with my solution (the first is just a change of parameters, actually).
<!-- xslt 1 and 2 -->
<xsl:template match="person[not(document[(_at_)rel-id =
../../../documents/document/@id])]">
<person name="{name}" />
</xsl:template>
<!-- xslt 2 only, a bit obfuscated perhaps... -->
<xsl:template match="person[not(some $i in //document/@id satisfies $i =
document/@rel-id)]">
<person name="{name}" />
</xsl:template>
I hoped to do the following, which reads much clearer in XSLT 2, but it
won't work, because 'rel-id' and 'id' do not share the same name (hence
there identity is not equal etc etc). And an attribute does not have a
text() child node... :S
<xsl:template match="person[empty(//documents/document/@id intersect
document/@rel-id)]">
<person name="{name}" />
</xsl:template>
if 'rel-id' were written 'id' in the source tree (and you change the
match accordingly) this would work. Unfortunately, the operator
'intersect' is defined to compare nodes only, and cannot compare
sequences of strings... :S
Cheers
-- Abel Braaksma
http://www.nuntia.nl
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--