[xml] XSLT question
- From: Colin Fox <cfox cfconsulting ca>
- To: xml gnome org
- Subject: [xml] XSLT question
- Date: Mon, 11 Apr 2005 14:40:10 -0700
-----BEGIN PGP SIGNED MESSAGE-----
I've got a question about XSLT and libxslt.
Assuming an XML file that looks like this:
<table name='people' schema='public'>
<table name='accounts' schema='financial'>
We have tables under 'schema', and each table has an attribute called
'schema' (unfortunate names, but not my choice).
What I need to do is to compile a unique list of nodes that are
comprised of the schema attributes.
In SQL, it would be:
select distinct (schema) from table;
I need it as a node list so that I can use xsl:for-each and iterate
through the list.
I'm currently working with the key() function, and I have the key
definition and the invocation.
The defintion is:
<xsl:key name='schemas_key' match='table' use='@schema' />
The usage is:
<xsl:sort select="." />
<xsl:copy-of select="." />
This doesn't seem to work, and also, I get this message as the first
line of output:
xsltApplyOneTemplate: key was not compiled
Can anyone suggest an example for getting a unique or distinct list of
values for a particular attribute? What I have here is the best I've
been able to come up with so far by going through my books.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
-----END PGP SIGNATURE-----
] [Thread Prev