Dominik Urbaez Gomez
<pacjent plec='m' oddzial='Choroby Wewnetrzne'>
<imie>Jerzy</imie>
<nazwisko>Nowak</nazwisko>
<wiek>67</wiek>
<leki>
<lek>
<nazwa>Buderin</nazwa>
<dawka>3 x 1 tabletka</dawka>
</lek>
<lek>
<nazwa>Filytol</nazwa>
<dawka>1 x 1 tabletka</dawka>
</lek>
</leki>
</pacjent>
lekarz, pielegniarka, pacjent,produkt{
display: block;
padding: 3px;
border: solid #a2a8d3;
margin: 4px;
background-color: #FDCEA2
}
lekarze:before{
content: "LEKARZE:";
}
nazwisko, nazwa, model, specjalizacja{
font-size: 15px;
font-weight: bold;
}
specjalizacja{
color: #a2a8d3;
}
imie, nazwisko, model{
text-decoration: underline;
}
lekarze:hover, pielegniarki:hover, pacjenci:hover, diagnostyka:hover, chirurgia:hover, komputery:hover{
background: red;
}
lekarze{
counter-reset: lek;
}
lekarz:before{
counter-increment: lek;
content: counter(lek);
}
lekarze, pielegniarki, pacjenci, diagnostyka, chirurgia, komputery{
display: inline;
float: left;
width: 30%;
border: solid #a2a8d3;
margin: 6px;
filter: drop-shadow(-1px 6px 3px rgba(50, 50, 0, 0.5));
transition: background 0.5s ease-out;
-webkit-transition: background-color 2s ease-out;
-moz-transition: background-color 2s ease-out;
-o-transition: background-color 2s ease-out;
transition: all 2s ease-out;
background-image: linear-gradient(72deg,#ffa952, #feffdf);
}
nazwisko:hover, specjalizacja:hover{
color:#f00;
transition: all 0.5s ease;
}
<!ELEMENT sprzet (rodzaje)>
<!ELEMENT leki (lek+)>
<!ELEMENT lekarze (lekarz)*>
<!ELEMENT lek (nazwa, dawka?)>
<!ELEMENT imie (%pcd;)>
<![IGNORE[ <!ELEMENT pracownicy ((lekarze, pielegniarki) | (inni))*> ]]>
<!ATTLIST produkt stan %cd; %imp;>
<!ATTLIST lekarz oddzial %cd; %rq;>
<!ATTLIST produkt stan %cd; #FIXED 'dobry'>
<!ATTLIST lekarz plec (m|k) %rq;>
<!ATTLIST produkt producent NMTOKEN %rq;>
<!ATTLIST pielegniarka oddzial NMTOKENS %rq;>
<!ENTITY % cd "CDATA">
<!ENTITY % rq "#REQUIRED">
<![INCLUDE[ <!ELEMENT pracownicy (lekarze, pielegniarki)*> ]]>
<![IGNORE[ <!ELEMENT pracownicy ((lekarze, pielegniarki) | (inni))*> ]]>
<xs:simpleType name="oddzialType2">
<xs:restriction base="xs:string">
<xs:pattern value="ODZ[0-9]{3}"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="oddzialType">
<xs:restriction base="xs:string">
<xs:minLength value="5"/>
<xs:maxLength value="50"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="plecType">
<xs:restriction base="xs:string">
<xs:enumeration value="k"/>
<xs:enumeration value="m"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="oddzialyType">
<xs:list itemType="oddzialType"/>
</xs:simpleType>
<xs:complexType name="lekarzeType">
<xs:sequence>
<xs:element type="lekarzType" name="lekarz" maxOccurs="unbounded" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:attribute type="plecType" name="placa" use="required"/>
<xs:simpleType name="stazType">
<xs:restriction base="xs:integer">
<xs:minInclusive value="0"/>
<xs:maxInclusive value="50"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="wiekType">
<xs:restriction base="xs:unsignedInt">
<xs:minExclusive value="0"/>
<xs:maxExclusive value="120"/>
</xs:restriction>
</xs:simpleType>
<xs:complexType name="lekarzeType">
<xs:sequence>
<xs:element type="lekarzType" name="lekarz" maxOccurs="unbounded" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:attribute type="oddzialyType" name="oddzial" default="Ogolny"/>
<xs:attribute type="xs:string" name="stan" fixed="dobry"/>
<xs:attribute type="plecType" name="plec" use="optional"/>
<xs:group name="imieNazw">
<xs:sequence>
<xs:element name="imie" type="xs:string"/>
<xs:element name="nazwisko" type="xs:string"/>
</xs:sequence>
</xs:group>
<xs:simpleType name="oddzialType">
<xs:union memberTypes="oddzialType1 oddzialType2"/>
</xs:simpleType>
<xs:simpleType name="placaType">
<xs:restriction base="xs:integer">
<xs:totalDigits value="5"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="godzinyPracyType">
<xs:restriction base="xs:string">
<xs:length value="11"/>
</xs:restriction>
</xs:simpleType>
<xs:complexType name="rodzajeType">
<xs:all>
<xs:element type="diagnostykaType" name="diagnostyka"/>
<xs:element type="chirurgiaType" name="chirurgia"/>
<xs:element type="komputeryType" name="komputery"/>
</xs:all>
</xs:complexType>
<xs:complexType name="pracownicyType">
<xs:choice>
<xs:sequence>
<xs:element type="lekarzeType" name="lekarze"/>
<xs:element type="pielegniarkiType" name="pielegniarki"/>
</xs:sequence>
<xs:sequence>
<xs:element type="pracownicyType" name="pracownicy"/>
</xs:sequence>
</xs:choice>
</xs:complexType>
<xs:element name="imie" type="xs:string"/>
<xs:simpleType name="stazType">
<xs:restriction base="xs:integer">
<xs:minInclusive value="0"/>
<xs:maxInclusive value="50"/>
</xs:restriction>
</xs:simpleType>
<xs:attribute type="xs:boolean" name="nadgodziny" use="required"/>
<xs:element name="rocznik" type="xs:positiveInteger"/>
<xs:element name="dawka" type="xs:float"/>
<xs:simpleType name="wiekType">
<xs:restriction base="xs:unsignedInt">
<xs:minExclusive value="0"/>
<xs:maxExclusive value="120"/>
</xs:restriction>
</xs:simpleType>
<td>
<b><xsl:text>Wynagrodzenia lekarzy: </xsl:text></b>
</td>
<td>
<xsl:for-each select="pracownicy/lekarze/lekarz">
<xsl:value-of select="substring(@placa,0,5)"/>
<xsl:text> PLN</xsl:text>
<br/>
</xsl:for-each>
</td>
<td>
<xsl:for-each select="pracownicy/lekarze/lekarz">
<xsl:sort select="@placa" order="descending"/>
<xsl:choose>
<xsl:when test="@plec='k'">
<p class="women">
<xsl:value-of select="imie "/>
<xsl:text> </xsl:text>
<xsl:value-of select="nazwisko"/>
</p>
</xsl:when>
<xsl:otherwise>
<p class="men">
<xsl:value-of select="imie "/>
<xsl:text> </xsl:text>
<xsl:value-of select="nazwisko"/>
</p>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</td>
<td>
<xsl:for-each select="pracownicy/lekarze/lekarz">
<xsl:if test="substring(@placa,0,5) > 4000">
<xsl:value-of select="@placa"/>
<br/>
</xsl:if>
</xsl:for-each>
</td>
<xsl:comment>
To jest opis danych dotyczących szpitala zawartych w pliku xml.
</xsl:comment>
<td>
<b><xsl:text>Ilość lekarzy</xsl:text></b>
</td>
<td>
<xsl:call-template name="zarobki"/>
</td>
<tr>
<td>
<b><xsl:text>Ilość lekarzy</xsl:text></b>
</td>
<td>
<xsl:value-of select="count(pracownicy/lekarze/lekarz)"/>
</td>
</tr>
<td>
<b><xsl:text>Średnia wieku wszystkich pacjentów: </xsl:text></b>
</td>
<td>
<xsl:value-of select="sum(pacjenci/pacjent/wiek) div count(pacjenci/pacjent)"/>
</td>
<td>
<b><xsl:text>Wynagrodzenia lekarzy: </xsl:text></b>
</td>
<td>
<xsl:for-each select="pracownicy/lekarze/lekarz">
<xsl:value-of select="substring(@placa,0,5)"/>
<xsl:text> PLN</xsl:text>
<br/>
</xsl:for-each>
</td>
<td>
<b><xsl:text>Pielegniarki posiadające nadgodziny:</xsl:text></b>
</td>
<td>
<xsl:for-each select="pracownicy/pielegniarki/pielegniarka[@nadgodziny='true']">
<xsl:value-of select="concat('Imie: ', imie)"/>
<br/>
<xsl:value-of select="concat('Nazwisko: ', nazwisko)"/>
<br/>
</xsl:for-each>
</td>
<td>
<b><xsl:text>Średnia wieku wszystkich pacjentów: </xsl:text></b>
</td>
<td>
<xsl:value-of select="sum(pacjenci/pacjent/wiek) div count(pacjenci/pacjent)"/>
</td>
<xsl:if test="substring(@placa,0,5) > 4000">
<xsl:value-of select="@placa"/>
<br/>
</xsl:if>
<xsl:if test="contains(@stan,'dobry')">
<xsl:value-of select="@producent"/>
<xsl:text> </xsl:text>
<xsl:value-of select="model"/>
<br/>
</xsl:if>
def getValFromElemByTag(element, tag):
return str(element.getElementsByTagName(tag)[0].firstChild.data)
def getValFromAttrByTag(element, tag):
return str(element.getAttribute(tag))
def poprawnoscPolityczna():
try:
for l in lekarze:
l.removeAttribute("plec")
except NotFoundErr:
print("No such attribute in this element!")
for s in stacjo:
if s.hasAttribute("stan"):
s.setAttribute("stan", "dobry")
nowy = pacjenci.getElementsByTagName("pacjent")[0].cloneNode(deep=True)
choroba = doc.createElement("choroba")
chorobaText = doc.createTextNode(_choroba)
choroba.appendChild(chorobaText)
nowy.getElementsByTagName("imie")[0].firstChild.nodeValue = _imie
for p in pacjenci:
if p.getElementsByTagName("nazwisko")[0].firstChild.data == _nazwisko:
szpital.getElementsByTagName("pacjenci")[0].removeChild(p)
def ilePacjentow():
if pacjenci.hasChildNodes():
return pacjenci.length
nowy.insertBefore(doc.createComment("NOWY PACJENT"),nowy.getElementsByTagName("imie")[0])