W3C home > Mailing lists > Public > xmlschema-dev@w3.org > June 2002

Re: Transformation XML to Datapacket

From: Jeni Tennison <jeni@jenitennison.com>
Date: Wed, 19 Jun 2002 11:06:23 +0100
Message-ID: <110-1634153639.20020619110623@jenitennison.com>
To: "Pierre Louis" <plouise@wanadoo.fr>
CC: xmlschema-dev@w3.org

Hi Pierre,

> I do use Xml file, I need to convert the file to xml datapacket.
>
> I want the attribute fieldname of the datapacket get the caption
> value of the field.
> Something like the following for the field "Name":
> fieldname=value of the caption of the field.

First, I think that you're addressing this question to the wrong forum
-- xmlschema-dev@w3.org is concerned with XML Schema rather than
transforming XML.

Second, it looks as though you're creating your own transformation
language to describe the transformation that you want to make. You
might find it easier to use an existing transformation language, such
as XSLT, instead, or perhaps to transform your transformation language
to XSLT so that you can take advantage of those tools. A simplified
XSLT stylesheet for the transformation you appear to wish to make is:

<DATAPACKET Version="2.0"
            xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
            xsl:version="1.0">
  <METADATA>
    <FIELDS>
      <FIELD attrname="No_" fieldtype="string" WIDTH="13"/>
      <FIELD attrname="Name" fieldtype="string" WIDTH="28"/>
    </FIELDS>
    <PARAMS/>
  </METADATA>
  <ROWDATA>
    <xsl:for-each select="/tst/Customer">
      <ROW No_="{No_}" Name="{Name}"
           Search_Name="{Search_Name}" City="{City}" />
    </xsl:for-each>
  </ROWDATA>
</DATAPACKET>

Note that XSLT 1.0 doesn't use information from a schema to perform a
transformation. This feature is added in XSLT 2.0.

I suggest you direct questions about XSLT to XSL-List@mulberrytech.com
(see http://www.mulberrytech.com/xsl/xsl-list).

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/
Received on Wednesday, 19 June 2002 06:06:28 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:31 GMT