The problem has multiple facets:
- How to categorize based on specific space separated contents of a tag
- How to categorize for lack of such specific content.
As an example, take the following data:
<messages>
<m>
<subject>message tagged with A B C</subject>
<tags>A B C</tags>
</m>
<m>
<subject>message tagged with B C D</subject>
<tags>B C D</tags>
</m>
<m>
<subject>message tagged with X Y A</subject>
<tags>X Y A</tags>
</m>
<m>
<subject>message tagged with C X</subject>
<tags>C X</tags>
</m>
<m>
<subject>message tagged with Y</subject>
<tags>Y</tags>
</m>
</messages>
Given a known set of tags, say
<xsl:param name="pKnownTags">
<t>A</t>
<t>B</t>
</xsl:param>
I want to generate an output that would look like:
Messages tagged with A:
* message tagged with A B C
* message tagged with X Y A
Messages tagged with B:
* message tagged with A B C
* message tagged with B C D
Messages tagged with neither:
* message tagged with C X
* message tagged with Y
Using EXSLT is fine, but otherwise need 1.0 solution. Is this possible?
This doesn't require anything too fancy. Please give the below a try:
when run on your sample input, this produces: