Please, somebody help. I need to transform xml into xml with xsl.
it´s urgent.
the attach files are the input in XML and output is what the prof. want.

Help-me please

Corin

thanks

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>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.