Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

Issues with XML

xml

  • Please log in to reply
No replies to this topic

#1 JackPanzer

JackPanzer

    CC Newcomer

  • Member
  • PipPip
  • 16 posts
  • Location:/dev/sda2/spain
  • Programming Language:Java, C++, C#, JavaScript, PL/SQL
  • Learning:PHP, Python, Ruby

Posted 31 December 2011 - 12:04 PM

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 Thumbnails

  • xml.png

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

  • 0





Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download