XML/XSL double conditions and filters



I try to build a XML database and query it based on a XLS. This is my xml :



<?xml version="1.0"?>
<?xml-stylesheet type="application/xml" href="bdd.xsl"?>
<catalogue>

<domain type="dom1">
<data type="aaa">
<profil>profil 1</profil>
<dispo>yes</dispo>
</data>
</domain>

<domain type="dom1">
<data type="aaa">
<profil>profil 2</profil>
<dispo>no</dispo>
</data>
</domain>

<domain type="dom1">
<data type="bbb">
<profil>profil 3</profil>
<dispo>yes</dispo>
</data>
</domain>

<domain type="dom2">
<data type="bbb">
<profil>profil 1</profil>
<dispo>no</dispo>
</data>
</domain>

<domain type="dom2">
<data type="bbb">
<profil>profil 2</profil>
<dispo>no</dispo>
</data>
</domain>

</catalogue>


and my XLS :



<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://ift.tt/tCZ8VR">

<xsl:output method="html"/>

<xsl:template match="/">
<html>
<head>
<title>Title 1</title>
<style type="text/css">
th {background-color:silver;}
td {border-style:solid; border-width:1px;}
</style>
</head>
<body>
<h2>...</h2>
<table>
<tr>
<th>profil</th>
<th>dispo</th>
</tr>
<xsl:apply-templates select="catalogue[domain[@type='dom1'] and domaine/data[@type='aaa']]" />
</table>
<br/>
<table>
<tr>
<th>profil</th>
<th>dispo</th>
</tr>
<xsl:apply-templates select="catalogue[domain[@type='dom2']/data[@type='bbb']]" />
</table>
</body>
</html>
</xsl:template>

<xsl:template match="domain">
<tr>
<td><xsl:value-of select="data/profil"/><i>4444444</i><xsl:value-of select="data/profil"/><xsl:value-of select="data/profil"/><xsl:value-of select="data/profil"/><xsl:value-of select="data/profil"/></td>
<td><xsl:value-of select="concat(data/profil, ' ', data/dispo)"/></td>

</tr>
</xsl:template>
</xsl:stylesheet>


I do not know why the result is my entire XML. Filters and conditions do not work. I was expecting this result : domain=dom1 ; data=aaa profil 1 ; yes


domain=dom2 ; data=bbb profil 3 ; yes profil 1 ; no profil 1 ; no


Thank you in advance for your help and advices,


No comments:

Post a Comment