[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
[xsl] XML reformatting
[xsl] XML reformatting
Subject: [xsl] XML reformatting <xsl:element & <xsl:for-each
From: "Alan Flaherty" <alan@xxxxxxxxxxxxxxxxxx>
Date: Tue, 7 Jan 2003 13:59:55 -0000
Hi List,
I have an xml file below that needs to be transformed before I can use
it, the problem is that in the <Table> section there may be more
parameters later on, this file is coming from a database.
I'm trying to use the <xsl:element> in the template for the <Table>
section and loop through all the child nodes of <Table> to put them in
the output xml, but It keeps saying that the element name is not a
QName, How can I accomplish this???
I'm also getting Odd errors about <xsl:text>, 'Unexpected Child'.
Must say thanks to Joerg Heinicke for his insight on my previous
question, had spent ages on trying to get that working yesterday, seems
so simple now :), hindsight :)
Xslt:
<xsl:template match="Table">
<xsl:for-each select="*">
<xsl:text>
<xsl:value-of select="current()/text()"/>
</xsl:text>
<xsl:element name="name()">
<xsl:value-of select="current()/text()"/>
</xsl:element>
</xsl:for-each>
</xsl:template>
Original Xml:
<NewDataSet>
<Table>
<ElementId>14</ElementId>
<Title>Duchessa 3in1</Title>
<Code>dc31</Code>
<Description>This classic Duchessa 3in1 carrycot and
pushchair combination features soft curved sides, concealing a pocket
with carry handles, finished with decorative piping. This perfect
combination has been designed with an air conditioning system that
allows air to flow through the carrycot, keeping baby cool and a soft
pram liner is included for extra comfort. There is a four panel padded
hood and the scupltured apron has an attractive embroidery. The padded
pushchair unit is reversible, with a multi position back rest, fuve
point harness, adjustable bumper bar and two position foot rest. To
complete the look in Bianco Blue there is a co-ordinating pram bag
included.
The Duchessa 3in1 is compatible with all the Cosatto chassis collection
and a co-ordinating Group 0+ car seat can be used with the chassis to
create a travek system.</Description>
<Price>99.99</Price>
<TaxId>1</TaxId>
</Table>
<Table1>
<Elementid>14</Elementid>
<FabricId>1</FabricId>
</Table1>
<Table1>
<Elementid>14</Elementid>
<FabricId>4</FabricId>
</Table1>
<Table1>
<Elementid>14</Elementid>
<FabricId>7</FabricId>
</Table1>
<Table1>
<Elementid>14</Elementid>
<FabricId>8</FabricId>
</Table1>
<Table2>
<Elementid>14</Elementid>
<Attributeid>15</Attributeid>
<Setting>AC</Setting>
</Table2>
<Table2>
<Elementid>14</Elementid>
<Attributeid>14</Attributeid>
<Setting>AF</Setting>
</Table2>
</NewDataSet>
Which I must transform to:
<Data>
<ElementId>14</ElementId>
<Title>Duchessa 3in1</Title>
<Code>dc31</Code>
<Description>This classic Duchessa 3in1 carrycot and pushchair
combination features soft curved sides, concealing a pocket with carry
handles, finished with decorative piping. This perfect combination has
been designed with an air conditioning system that allows air to flow
through the carrycot, keeping baby cool and a soft pram liner is
included for extra comfort. There is a four panel padded hood and the
scupltured apron has an attractive embroidery. The padded pushchair
unit is reversible, with a multi position back rest, fuve point harness,
adjustable bumper bar and two position foot rest. To complete the look
in Bianco Blue there is a co-ordinating pram bag included.
The Duchessa 3in1 is compatible with all the Cosatto chassis collection
and a co-ordinating Group 0+ car seat can be used with the chassis to
create a travek system.</Description>
<Price>99.99</Price>
<TaxId>1</TaxId>
<fabrics>
<FabricId>1</FabricId>
<FabricId>4</FabricId>
<FabricId>7</FabricId>
<FabricId>8</FabricId>
</fabrics>
<attributes>
<attribute id="15">Ac</attribute>
<attribute id="14">AF</attribute>
</attributes>
</data>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread
- Re: [xsl] passing xsl:value-of to HREF, (continued)
- Peter Finch - Tue, 07 Jan 2003 01:08:48 +1100
- Bruce McDougald - Mon, 6 Jan 2003 09:13:31 -0600
- Alan Flaherty - Mon, 6 Jan 2003 16:09:05 -0000
- Joerg Heinicke - Mon, 06 Jan 2003 22:22:02 +0100
- Alan Flaherty - Tue, 7 Jan 2003 13:59:55 -0000 <=
- Jeni Tennison - Tue, 7 Jan 2003 14:41:19 +0000
- David Carlisle - Tue, 7 Jan 2003 14:49:41 GMT
Ben Robb - Mon, 6 Jan 2003 13:59:09 -0000
<- Previous Index Next ->
Re: [xsl] Evaluating a variable as , Joerg Heinicke
Thread
Re: [xsl] XML reformatting <xsl:ele, Jeni Tennison
RE: [xsl] creating a string after c, Dimitre Novatchev
Date
RE: [xsl] creating a string after c, jfi
Month
Keywords
Subject: [xsl] XML reformatting <xsl:element & <xsl:for-each From: "Alan Flaherty" <alan@xxxxxxxxxxxxxxxxxx> Date: Tue, 7 Jan 2003 13:59:55 -0000 |
Hi List, I have an xml file below that needs to be transformed before I can use it, the problem is that in the <Table> section there may be more parameters later on, this file is coming from a database. I'm trying to use the <xsl:element> in the template for the <Table> section and loop through all the child nodes of <Table> to put them in the output xml, but It keeps saying that the element name is not a QName, How can I accomplish this??? I'm also getting Odd errors about <xsl:text>, 'Unexpected Child'. Must say thanks to Joerg Heinicke for his insight on my previous question, had spent ages on trying to get that working yesterday, seems so simple now :), hindsight :) Xslt: <xsl:template match="Table"> <xsl:for-each select="*"> <xsl:text> <xsl:value-of select="current()/text()"/> </xsl:text> <xsl:element name="name()"> <xsl:value-of select="current()/text()"/> </xsl:element> </xsl:for-each> </xsl:template> Original Xml: <NewDataSet> <Table> <ElementId>14</ElementId> <Title>Duchessa 3in1</Title> <Code>dc31</Code> <Description>This classic Duchessa 3in1 carrycot and pushchair combination features soft curved sides, concealing a pocket with carry handles, finished with decorative piping. This perfect combination has been designed with an air conditioning system that allows air to flow through the carrycot, keeping baby cool and a soft pram liner is included for extra comfort. There is a four panel padded hood and the scupltured apron has an attractive embroidery. The padded pushchair unit is reversible, with a multi position back rest, fuve point harness, adjustable bumper bar and two position foot rest. To complete the look in Bianco Blue there is a co-ordinating pram bag included. The Duchessa 3in1 is compatible with all the Cosatto chassis collection and a co-ordinating Group 0+ car seat can be used with the chassis to create a travek system.</Description> <Price>99.99</Price> <TaxId>1</TaxId> </Table> <Table1> <Elementid>14</Elementid> <FabricId>1</FabricId> </Table1> <Table1> <Elementid>14</Elementid> <FabricId>4</FabricId> </Table1> <Table1> <Elementid>14</Elementid> <FabricId>7</FabricId> </Table1> <Table1> <Elementid>14</Elementid> <FabricId>8</FabricId> </Table1> <Table2> <Elementid>14</Elementid> <Attributeid>15</Attributeid> <Setting>AC</Setting> </Table2> <Table2> <Elementid>14</Elementid> <Attributeid>14</Attributeid> <Setting>AF</Setting> </Table2> </NewDataSet> Which I must transform to: <Data> <ElementId>14</ElementId> <Title>Duchessa 3in1</Title> <Code>dc31</Code> <Description>This classic Duchessa 3in1 carrycot and pushchair combination features soft curved sides, concealing a pocket with carry handles, finished with decorative piping. This perfect combination has been designed with an air conditioning system that allows air to flow through the carrycot, keeping baby cool and a soft pram liner is included for extra comfort. There is a four panel padded hood and the scupltured apron has an attractive embroidery. The padded pushchair unit is reversible, with a multi position back rest, fuve point harness, adjustable bumper bar and two position foot rest. To complete the look in Bianco Blue there is a co-ordinating pram bag included. The Duchessa 3in1 is compatible with all the Cosatto chassis collection and a co-ordinating Group 0+ car seat can be used with the chassis to create a travek system.</Description> <Price>99.99</Price> <TaxId>1</TaxId> <fabrics> <FabricId>1</FabricId> <FabricId>4</FabricId> <FabricId>7</FabricId> <FabricId>8</FabricId> </fabrics> <attributes> <attribute id="15">Ac</attribute> <attribute id="14">AF</attribute> </attributes> </data> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Evaluating a variable as , Joerg Heinicke | Thread | Re: [xsl] XML reformatting <xsl:ele, Jeni Tennison |
RE: [xsl] creating a string after c, Dimitre Novatchev | Date | RE: [xsl] creating a string after c, jfi |
Month |
Keywords