Filename : /home/admin/www/dansemusique.net/statique/util/dyna/uniq_adherents_xslt.php
<?php
 
// Tranforme les caractères accentués en caractères non accentués...
function html_entity_deemphasize($str)
{
   return preg_replace('/&(.)(grave|acute|circ|tilde|uml|ring|cedil|slash);/', '\1', $str);
}
 
 
/**
 * Recopie le xml à l'identique
 *
 * disable-output-escaping="no"
 * encoding="ISO-8859-1" 
 */
function  xsl_str__identity()
{
$xsl_str = <<<'EOT'
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE xsl:stylesheet SYSTEM "../util/lib-xml-xsl/xsl-html.dtd">
 
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" 
     indent="yes" 
     doctype-system="../../util/lib-xml-xsl/xml-html.dtd" 
     encoding="ISO-8859-1" 
     omit-xml-declaration="no" />
 
 	<xsl:template match="/">
	  <xsl:copy>
		<xsl:copy-of select="." />
	  </xsl:copy>
	</xsl:template>
 
</xsl:stylesheet>
EOT;
 
return $xsl_str;
}
 
 
function  xsl_str__preceding()
{
$xsl_str = <<<'EOT'
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE xsl:stylesheet SYSTEM "../util/lib-xml-xsl/xsl-html.dtd">
 
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" 
     indent="yes" 
     doctype-system="../../util/lib-xml-xsl/xml-html.dtd" 
     encoding="ISO-8859-1" 
     omit-xml-declaration="no" />
 
	<xsl:template match="/adherents">
		<adherents>
			<xsl:for-each select="//adherent[not(@id_adh=preceding-sibling::adherent/@id_adh)]">
				<xsl:copy-of select="." />
			</xsl:for-each>
		</adherents>
	</xsl:template>
 
</xsl:stylesheet>
EOT;
 
return $xsl_str;
}
 
// Attention : Si on ajoute un champ, il faut aussi le mettre :
//  * \statique\util\dyna\init_title_arrays.php
//  * \statique\util\dyna\generate_xml_from_csv.php
//  * \statique\util\dyna\uniq_adherents_xslt.php
 
function  xsl_str__uniq_adh()
{
$xsl_str = <<<'EOT'
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE xsl:stylesheet SYSTEM "../util/lib-xml-xsl/xsl-html.dtd">
 
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
 
<xsl:output method="xml" 
     indent="yes" 
     doctype-system="../../util/lib-xml-xsl/xml-html.dtd" 
     encoding="ISO-8859-1" 
     omit-xml-declaration="no" />
 
 
	<xsl:template match="/">
	    <xsl:variable name="doublons" select="/adherents/adherent[@id_adh=preceding-sibling::adherent[1]/@id_adh]" />
		<adherents>
			<xsl:for-each select="/adherents/adherent[not(@id_adh=preceding-sibling::adherent[1]/@id_adh)]">
				<adherent>
					<xsl:attribute name="id_adh">
						<xsl:value-of select="@id_adh" />
					</xsl:attribute>				
					<xsl:attribute name="nom">
						<xsl:value-of select="@nom" />
					</xsl:attribute>
					<xsl:attribute name="genre">
						<xsl:value-of select="@genre" />
					</xsl:attribute>				
					<xsl:attribute name="prenom">
						<xsl:value-of select="@prenom" />
					</xsl:attribute>				
					<xsl:attribute name="date_naissance">
						<xsl:value-of select="@date_naissance" />
					</xsl:attribute>				
					<xsl:for-each select="current()/*">
							<xsl:copy-of select="." />
					</xsl:for-each>
					<xsl:variable name="current_id_adh" select="current()/@id_adh" />
					<xsl:for-each select="$doublons[@id_adh=$current_id_adh]">
						<xsl:for-each select="current()/*">
								<xsl:copy-of select="." />
						</xsl:for-each>
					</xsl:for-each>
				</adherent>
			</xsl:for-each>
		</adherents>
	</xsl:template>
</xsl:stylesheet>
EOT;
 
return $xsl_str;
}
 
?>

    Driven by DokuWiki Recent changes RSS feed        
   
Nous vous rappelons que vous disposez d'un droit d'accès, de modification, de rectification et de suppression des données qui vous concernent. Pour exercer ce droit, adressez-vous au webmaster .