Subject: Re: [xsl] sequence with same id values From: David Carlisle <davidc@xxxxxxxxx> Date: Mon, 6 Mar 2006 13:29:45 GMT |
<xsl:variable name="anchor" as="element()*" select="document('source.xml')//anchor[parent::xref]/@id"/> How can I get all the id values that are not unique? It's best to say explicitly if you want an xpath2 solution (which you do here as you are using an as= attribute so you must be using xslt2) If you just want the distinct values, rather than a sequence of attribute nodes with distinct values then uou can go <xsl:variable name="anchor" as="xs:string*" select="distinct-values(document('source.xml')//anchor[parent::xref]/@id)"/> Your original as= attribute would generate errors as you are selecting attribute nodes but specifying a sequence of elements. Rather than testing on parent:: axis it's probably more natural (but equivalent) to write this as <xsl:variable name="anchor" as="xs:string*" select="distinct-values(document('source.xml')//xref/anchor/@id)"/> Depending on what you want to do with this list you may prefer to use an xsl:for-each-group rather than use distinct-values. David ________________________________________________________________________ This e-mail has been scanned for all viruses by Star. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] sequence with same id values, Jeff Sese | Thread | Re: [xsl] sequence with same id val, David Carlisle |
Re: [xsl] Split the content of a va, Silvia Liberto | Date | Re: [xsl] sequence with same id val, andrew welch |
Month |