Commit 0bdf4e7a authored by Administrator's avatar Administrator

Adds the XML and related files

The files from previous Katas have been added.
parent d0ab625c
@CHARSET "UTF-8";
body {
font-family: arial, sans-serif;
font-size: 0.8em;
}
h1 {
text-shadow: 1px 1px 1px #999;
}
h4 {
font-size: 1.25em;
text-shadow: 1px 1px 1px #999;
}
div#container {
margin: 0 auto;
max-width: 960px;
min-width: 200px;
}
div.descripcion {
float: left;
max-width: 600px;
min-width: 100px;
padding-right: 48px;
}
div.pasos {
clear: both;
}
div.info {
font-size: 0.9em;
width: 100%;
}
div.info>div:nth-child(n+2):before {
content: ". ";
}
div.info>div {
display: inline-block;
}
div.pasos {
clear: both;
}
div.pasos dt {
font-weight: bold;
}
\ No newline at end of file
$(function() {
$("#recetas").accordion({
autoHeight: false,
collapsible: true
});
});
\ No newline at end of file
This diff is collapsed.
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.ei.uvigo.es/dai/recetas"
xmlns:tns="http://www.ei.uvigo.es/dai/recetas"
elementFormDefault="qualified">
<simpleType name="medida">
<!-- miligramo, gramo, kilogramo, mililitro, litro,
pizca, cucharilla, cuchara y unidades -->
<restriction base="string">
<enumeration value="mg"/>
<enumeration value="g"/>
<enumeration value="kg"/>
<enumeration value="ml"/>
<enumeration value="l"/>
<enumeration value="pizca"/>
<enumeration value="cucharilla"/>
<enumeration value="cuchara"/>
<enumeration value="unidades"/>
</restriction>
</simpleType>
<simpleType name="dificultad">
<restriction base="string">
<enumeration value="Baja"/>
<enumeration value="Media"/>
<enumeration value="Alta"/>
</restriction>
</simpleType>
<complexType name="paso">
<simpleContent>
<extension base="string">
<attribute name="orden" type="unsignedInt" use="required"/>
<attribute name="accion" type="string" use="required"/>
</extension>
</simpleContent>
</complexType>
<complexType name="ingrediente">
<attribute name="nombre" type="string" use="required"/>
<attribute name="medida" type="tns:medida" use="required"/>
<attribute name="cantidad" type="unsignedInt" use="required"/>
</complexType>
<complexType name="autor">
<simpleContent>
<extension base="string">
<attribute name="id" type="ID" use="required"/>
</extension>
</simpleContent>
</complexType>
<complexType name="autor-ref">
<simpleContent>
<extension base="string">
<attribute name="id" type="IDREF" use="required"/>
</extension>
</simpleContent>
</complexType>
<complexType name="receta">
<sequence>
<element name="titulo" type="string"/>
<element name="autores" minOccurs="0">
<complexType>
<sequence>
<element name="autor" type="tns:autor-ref" maxOccurs="unbounded"/>
</sequence>
</complexType>
</element>
<element name="descripcion" type="string" minOccurs="0"/>
<element name="ingredientes">
<complexType>
<sequence>
<element name="ingrediente" type="tns:ingrediente" maxOccurs="unbounded"/>
</sequence>
</complexType>
</element>
<element name="pasos">
<complexType>
<sequence>
<element name="paso" type="tns:paso" maxOccurs="unbounded"/>
</sequence>
</complexType>
</element>
</sequence>
<attribute name="id" type="ID" use="required"/>
<attribute name="dificultad" type="tns:dificultad" default="Media"/>
<attribute name="personas" type="unsignedInt" use="required"/>
<attribute name="tiempo" type="unsignedInt"/>
</complexType>
<element name="recetas">
<complexType>
<sequence>
<element name="autor" type="tns:autor" minOccurs="0" maxOccurs="unbounded"/>
<element name="receta" type="tns:receta" maxOccurs="unbounded"/>
</sequence>
</complexType>
</element>
</schema>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:r="http://www.ei.uvigo.es/dai/recetas"
>
<xsl:output method="html" indent="yes" encoding="utf-8"/>
<xsl:template match="/" >
<html>
<head>
<title>Recetario</title>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/south-street/jquery-ui.css" />
<link rel="stylesheet" href="recetas.css" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>
<script src="recetas.js"></script>
</head>
<body>
<div id="container">
<h1>Recetario</h1>
<div id="recetas">
<xsl:apply-templates select="r:recetas/r:receta"/>
</div>
</div>
</body>
</html>
</xsl:template>
<xsl:template match="r:autores">
<div class="autores">
<h4>Autores</h4>
<ul>
<xsl:for-each select="r:autor">
<li><xsl:value-of select="id(@id)"/></li>
</xsl:for-each>
</ul>
</div>
</xsl:template>
<xsl:template match="r:receta">
<h3><xsl:value-of select="r:titulo"/></h3>
<div>
<div class="info">
<div class="dificultad">
<strong>Dificultad:</strong>&#160;<xsl:value-of select="@dificultad"/>
</div>
<div class="comensales">
<strong>Comensales:</strong>&#160;<xsl:value-of select="@personas"/>
</div>
<div class="tiempo">
<strong>Tiempo:</strong>&#160;<xsl:value-of select="@tiempo"/> mins.
</div>
</div>
<xsl:if test="r:autores">
<xsl:apply-templates select="r:autores"/>
</xsl:if>
<xsl:if test="r:descripcion">
<div class="descripcion">
<xsl:value-of select="r:descripcion" disable-output-escaping="yes"/>
</div>
</xsl:if>
<div class="ingredientes">
<h4>Ingredientes</h4>
<ul>
<xsl:for-each select="r:ingredientes/r:ingrediente">
<li>
<xsl:value-of select="@nombre"/>
[<xsl:value-of select="@cantidad"/>&#160;<xsl:value-of select="@medida"/>]
</li>
</xsl:for-each>
</ul>
</div>
<div class="pasos">
<h4>Pasos</h4>
<dl>
<xsl:for-each select="r:pasos/r:paso">
<xsl:sort select="@orden" order="ascending" data-type="number"/>
<dt>
Paso <xsl:value-of select="@orden"/>. <xsl:value-of select="@accion"/>
</dt>
<dd>
<xsl:value-of select="."/>
</dd>
</xsl:for-each>
</dl>
</div>
</div>
</xsl:template>
</xsl:stylesheet>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment