![]() |
![]() | ![]() | ![]() | Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - How to create CSV/Text form XML [Thread Next] Re: How to create CSV/Text form XMLTo: 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>
</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
>
>
| ![]() | ![]() | ![]() |
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | |||||
|
