RE: [xsl] Check for duplicate @id's - collection()

Subject: RE: [xsl] Check for duplicate @id's - collection()
From: "Philip Vallone" <philip.vallone@xxxxxxxxxxx>
Date: Sat, 19 Jul 2008 11:57:14 -0400
Ahhh Perfect. Thank you!
 

-----Original Message-----
From: Michael Kay [mailto:mike@xxxxxxxxxxxx] 
Sent: Saturday, July 19, 2008 11:44 AM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: RE: [xsl] Check for duplicate @id's - collection()


<xsl:for-each-group select="collection(...)//@id" group-by=".">
  <xsl:if test="count(current-group()) ne 1">
    <xsl:message>Id value <xsl:value-of select="current-grouping-key()"/> is
duplicated in files
      <xsl:value-of select="current-group()/document-uri(/)" separator=" and
"/></xsl:message>
  </xsl:if>
</xsl:for-each-group>

Michael Kay
http://www.saxonica.com/

> -----Original Message-----
> From: Philip Vallone [mailto:philip.vallone@xxxxxxxxxxx]
> Sent: 19 July 2008 16:28
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: [xsl] Check for duplicate @id's - collection()
> 
> Hi,
>  
> I have a project were I take about 800 files and transform them into 
> one .fo document (create a pdf). The files are authored independent of 
> each other (stand alone) which are validated against a schema 
> (independently). If there is a duplicate @id attribute, the validator 
> will tell me. However, the @ids need to be unique across all files 
> processed by the collection function. If they are not, my resulting 
> .fo will have duplicate @ids, which cause FOP to halt.
> 
> I am looking for a way to (query or xslt 2.0) to check for duplicate 
> @id's values across all files with the collection function. This would 
> be a pre-production check.
> 
> I am looking for ideas or suggestions. Also, I am using Saxon 9.1.0.1
> 
> Thanks,
> 
> Phil

Current Thread