Jump to content

Issues with XML

- - - - -

  • Please log in to reply
No replies to this topic

#1
JackPanzer

JackPanzer

    Newbie

  • Members
  • Pip
  • 4 posts
Hello everyone!

Merry Christmas, happy new year and all that stuff xD

***FIXED***
Now the xsl is correct x)

My XML file is like this:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>

<xml>

    <Documento>

        <CasoDeUso>

            <nombre>Some usecase 1</nombre>

            <eventoDeActivacion>PD</eventoDeActivacion>

            <detalles>PD</detalles>

            <abstracto>No</abstracto>

            <comentarios>PD</comentarios>

            <frecuencia>PD cada día</frecuencia>

            <postcondicion>PD</postcondicion>

            <precondicion>PD</precondicion>

            <pasos>

                <CuPaso>

                    <valor>1.- Some step1</valor>

                </CuPaso>

                <CuPaso>

                    <valor>2.- Some step2</valor>

                </CuPaso>

            </pasos>

            

        </CasoDeUso>

        <CasoDeUso>

            <nombre>Some usecase 2</nombre>

            <eventoDeActivacion>PD</eventoDeActivacion>

            <detalles>PD</detalles>

            <abstracto>No</abstracto>

            <comentarios>PD</comentarios>

            <frecuencia>PD cada día</frecuencia>

            <postcondicion>PD</postcondicion>

            <precondicion>PD</precondicion>

            <pasos/>

        </CasoDeUso>

    </Documento>

</xml>


To represent that data I'm using a XLS file like this:
<?xml version="1.0" encoding="UTF-8"?>


<!--

    Document   : XMLEasyReq.xsl

    Created on : December 30, 2011, 7:16 PM

    Author     : jackpanzer

    Description:

        Purpose of transformation follows.

-->


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

    <xsl:output method="html"/>


    <!-- TODO customize transformation rules 

         syntax recommendation http://www.w3.org/TR/xslt 

    -->

    <xsl:template match="/">

        <xsl:for-each select="//CasoDeUso">

            <p/>

            <p/>

            <table border="1">

                <tr>

                    <th>Nombre</th>

                    <td><xsl:value-of select="nombre" /></td>

                </tr>

                <tr>

                    <th>Detalle</th>

                    <td><xsl:value-of select="detalle" /></td>

                </tr>

                <tr>

                    <th>¿Es abstracto?</th>

                    <td><xsl:value-of select="abstracto" /></td>

                </tr>

                <tr>

                    <th>Evento de activación</th>

                    <xsl:value-of select="eventoDeActivacion" />

                </tr>

                <tr>

                    <th>Frecuencia</th>

                    <td><xsl:value-of select="frecuencia" /></td>

                </tr>

                <tr>

                    <th>Precondición</th>

                    <td><xsl:value-of select="precondicion" /></td>

                </tr>

                <tr>

                    <th>Postcondición</th>

                    <td><xsl:value-of select="postcondicion" /></td>

                </tr>

                <tr>

                    <th>Comentarios</th>

                    <td><xsl:value-of select="comentarios" /></td>

                </tr>

                <tr>

                    <th>Pasos</th>

                    <td>

                        <xsl:for-each select="pasos//CuPaso">

                            <xsl:value-of select="valor"/>

                            <br/>

                        </xsl:for-each>

                    </td>

                </tr>

            </table>

            

        </xsl:for-each>

    </xsl:template>


</xsl:stylesheet>


***FIXED*** x)

Attached Files

  • Attached File  xml.png   25.48K   8 downloads

Edited by JackPanzer, 02 January 2012 - 06:48 AM.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users