2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by iceandrews
0

Have fun cheating!

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

	<xsl:template match="/">
		<xsl:apply-templates select="EscolaNatacao"/>
	</xsl:template>

	<xsl:template match="EscolaNatacao">
		<xsl:copy>
			<xsl:apply-templates select="Turma"/>
		</xsl:copy>
	</xsl:template>

	<xsl:template match="Turma">
		<Classe>
			<xsl:apply-templates select="@numero"/>
			<xsl:apply-templates select="FaixaEtaria/@nivel"/>
			<xsl:apply-templates select="FaixaEtaria"/>
			<xsl:apply-templates select="Dias/Dia" />
		</Classe>
	</xsl:template>

	<xsl:template match="@numero">
		<xsl:copy/>
	</xsl:template>

	<xsl:template match="@nivel">
		<xsl:copy/>
	</xsl:template>

	<xsl:template match="FaixaEtaria">
		<Idades>
			<xsl:apply-templates select="@idadeMinima"/>
			<xsl:apply-templates select="@idadeMaxima"/>
		</Idades>
	</xsl:template>

	<xsl:template match="@idadeMinima">
		<Minima>
			<xsl:value-of select="." />
		</Minima>
	</xsl:template>

	<xsl:template match="@idadeMaxima">
		<Maxima>
			<xsl:value-of select="." />
		</Maxima>
	</xsl:template>

	<xsl:template match="Dia" >
		<Data>
			<xsl:attribute name="dia">
				<xsl:value-of select="." />
			</xsl:attribute>
			<xsl:apply-templates select="@hora" />
		</Data>
	</xsl:template>

	<xsl:template match="@hora" >
		<xsl:variable name="hora" select="substring(.,1,2)" />
		<xsl:variable name="minuto" select="substring(.,4,2)"/>		
		<xsl:choose>
			<xsl:when test="$minuto != '00'" >
				<xsl:value-of select="concat($hora, ' horas e ', $minuto, ' minutos')" />
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="concat($hora, ' horas')" />
			</xsl:otherwise>
			</xsl:choose>	
	</xsl:template>	
</xsl:stylesheet>
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.