Reputation: 672
I want to show everything from xml without table Zdrowe. How can i hide this. I was create XSLT but every fields from Zdrowe are in my output file and I don't know how to hide that. I can't delete Zdrowe from xml because I must have this in xml.
My XML:
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="wyswietl.xsl"?>
<Pacjenci>
<Pacjent>
<Dane>
<Imię>Krzysztof</Imię>
<Nazwisko>Żubr</Nazwisko>
<DataUrodzenia>07-05-1991</DataUrodzenia>
<Adres>Szczawiowa 6</Adres>
<Miasto>Wrocław</Miasto>
<Pesel>91050712897</Pesel>
<ImięMatki>Joanna</ImięMatki>
<ImięOjca>Bartosz</ImięOjca>
<NazwiskoRodowe>Żubr</NazwiskoRodowe>
</Dane>
<Zeby>
<Chore>
<li>Górna 1</li>
<li>Górna 5</li>
<li>Górna 6</li>
<li>Dolna 1</li>
<li>Dolna 2</li>
<li>Dolna 6</li>
<li>Dolna 7</li>
<li>Dolna 12</li>
</Chore>
<Zdrowe>
<lii>Górna 2</lii>
<lii>Górna 3</lii>
<lii>Górna 4</lii>
<lii>Górna 7</lii>
<lii>Górna 8</lii>
<lii>Górna 9</lii>
<lii>Górna 10</lii>
<lii>Górna 11</lii>
<lii>Górna 12</lii>
<lii>Dolna 3</lii>
<lii>Dolna 4</lii>
<lii>Dolna 5</lii>
<lii>Dolna 8</lii>
<lii>Dolna 9</lii>
<lii>Dolna 10</lii>
<lii>Dolna 11</lii>
</Zdrowe>
</Zeby>
</Pacjent>
</Pacjenci>
And my xslt file:
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml">
<xsl:output method="html" indent="yes"
doctype-public="-//W3C//DTD XHTML 1.1//EN"
doctype-system="http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"/>
<xsl:template match="Pacjenci">
<html>
<head> <title>Pacjenci gabinetu stomatologicznego</title> </head>
<body>
<xsl:apply-templates/>
</body>
</html>
</xsl:template>
<xsl:template match="Dane">
<tr>
<td>
<h3>
Pacjent: <xsl:value-of select="Imię"/><xsl:value-of select="Nazwisko"/>
</h3>
</td>
</tr>
<h3>Dane identyfikacyjne pacjenta:</h3>
<tr><td>Imię: <xsl:value-of select="Imię"/></td></tr><br />
<tr><td>Nazwisko: <xsl:value-of select="Nazwisko"/></td></tr><br />
<tr><td>Adres: <xsl:value-of select="Adres"/></td></tr><br />
<tr><td>Miasto: <xsl:value-of select="Miasto"/></td></tr><br />
<tr><td>Pesel: <xsl:value-of select="Pesel"/></td></tr><br />
<tr><td>Imię matki: <xsl:value-of select="ImięMatki"/></td></tr><br />
<tr><td>Imię ojca: <xsl:value-of select="ImięOjca"/></td></tr><br />
<tr><td>Nazwisko rodowe: <xsl:value-of select="NazwiskoRodowe"/></td></tr><br />
<br />
</xsl:template>
<xsl:template match="Chore">
<h3>Zęby chore:</h3>
<table>
<xsl:apply-templates/>
</table>
</xsl:template>
<xsl:template match="li">
<tr><td><xsl:value-of select="."/></td></tr>
</xsl:template>
</xsl:stylesheet>
Upvotes: 1
Views: 1431
Reputation: 60424
Add a template that swallows the element (i.e. matches it and does nothing):
<xsl:template match="Zdrowe"></xsl:template>
Upvotes: 2