W3C home > Mailing lists > Public > public-i18n-its@w3.org > July to September 2005

[ESW Wiki] Update of "its0505ReqUniqueID" by fsasaki

From: <w3t-archive+esw-wiki@w3.org>
Date: Thu, 21 Jul 2005 04:23:26 -0000
To: w3t-archive+esw-wiki@w3.org
Message-ID: <20050721042326.17467.54728@localhost.localdomain>
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "ESW Wiki" for change notification.

The following page has been changed by fsasaki:
http://esw.w3.org/topic/its0505ReqUniqueID


------------------------------------------------------------------------------
  
   * Using URIs, where the in-document ID is a fragment identifier.
  
+ The requirement can be fulfiled by the following XQuery user defined function:
+ 
+ {{{
+ query version "1.0";
+ declare namespace eg = "http://example.com#";
+ declare function eg:checkUniqueness  
+ ($inputSequence as item()*) as item()*
+ {
+ for $node in $inputSequence//element()
+ for $comparedNodes in $inputSequence//element() except $node
+ where $comparedNodes/@id = $node/@id
+ return "Error! ID is already defined!"
+ };
+ }}}
+ 
+ The same function can be defined in XSLT:
+ 
+ {{{
+ <xsl:function name="eg:checkUniqueness" as="item()*">
+  <xsl:param name="inputSequence" as="item()*"/>
+   <xsl:for-each select="$inputSequence//element()">
+   <xsl:variable name="node" select="."/>
+  <xsl:variable name="comparedNodes" select="$inputSequence//element() except $node"/>
+  <xsl:for-each select="$comparedNodes[@id = $node/@id]">
+  <xsl:text>Error! ID is already defined!</xsl:text>  
+  </xsl:for-each>
+  </xsl:for-each>
+ </xsl:function>	
+ }}}
+ 
Received on Thursday, 21 July 2005 07:11:46 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 8 January 2008 14:12:45 GMT