Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: How to create CSV/Text form XML

From: "Matt" <mdframe@-------.--------------.--->
To: NULL
Date: 4/1/2005 12:26:00 PM
Stefan,

Here is a quick way to get what you want.

HTH,

Matt

<?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="text" encoding="US-ASCII"/>
    <xsl:template match="/">
        <xsl:apply-templates select="//item_field[@dbid='feld2' or
@dbid='feld4']"/>
    </xsl:template>
    <xsl:template match="item_field">
        <xsl:choose>
            <xsl:when test="@dbid = 'feld2'">
                <xsl:value-of select="concat(@label,';',.,';')"/>
            </xsl:when>
        <xsl:otherwise>
            <xsl:value-of select="concat(@label,';',.)"/>
            <xsl:text>&#x0D;&#x0A;</xsl:text> <!-- Carriage Return
LineFeed -->
            </xsl:otherwise>
        </xsl:choose>
    </xsl:template>
</xsl:stylesheet>

"stefan" <stefan.priegnitz@f...> wrote in message
news:d2j1n4$ajd$1@a......
> Hello *,
>
> i've no expierence with XML and I hope someone can help me out with this.
> Following problem:
> I've an XML File and need just some parts (lines) in the result file. This
> should have CSV/text style.
> In this case I need only lines where dbid="feld2" or dbid="feld4".
>
> <?xml version="1.0" encoding="UTF-8"?>
> <items title="Execution">
>   <item>
>     <item_field dbid="feld1" label="Plan: Name" root="106"
edit_type="list"
> size="40">Hupe</item_field>
>     <item_field dbid="feld2" label="Plan: Date" edit_type="date"
> size="10">15.02.2005</item_field>
>     <item_field dbid="feld3" label="Plan: Beschreibung" edit_type="memo"
> size="-1">washtmlonceConnect SUT as modem to PC with Vodafone</item_field>
>     <item_field dbid="feld4" label="Plan: Ersteller" root="-1"
> edit_type="list" size="20">Heinz</item_field>
>   </item>
>   <item>
>     <item_field dbid="feld1" label="Plan: Name" root="106"
edit_type="list"
> size="40">Honk</item_field>
>     <item_field dbid="feld2" label="Plan: Date" edit_type="date"
> size="10">18.02.2005</item_field>
>     <item_field dbid="feld3" label="Plan: Beschreibung" edit_type="memo"
> size="-1">washtmlonceSet up call via IrDA using AT commands with
> Vodafone</item_field>
>     <item_field dbid="feld4" label="Plan: Ersteller" root="-1"
> edit_type="list" size="20">Heino</item_field>
>   </item>
> </items>
>
> The result should look like this:
>
> Plan: Date;15.02.2005;Plan: Ersteller;Heinz
> Plan: Date;18.02.2005;Plan: Ersteller;Heino
>
> I need an XLS file which does the convertion.
>
> As converter I'm using saxon.
>
>
> Thanks Stefan
>
>




transparent
Print
Mail
Digg
delicious
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent