M
Mr_Noob
Hi all,
here is a sample on my xml file :
<systems>
<controllers>
<id>1</id>
<name>controller1</name>
<memory>4096</memory>
<hosts>
<id>1</id>
<name>host1</name>
<memory>256</memory>
<id>2</id>
<name>host2</name>
<memory>256</memory>
</hosts>
<id>2</id>
<name>controller2</name>
<memory>4096</memory>
</controllers>
</systems>
I am trying to write an xsl stylesheet that would generate the
following output :
insert into controllers (name, memory) values (controller1, 4096);
insert into hosts (id, name, memory, controller_id) values (1, host1,
256, 1);
insert into hosts (id, name, memory, controller_id) values (2, host2,
256, 1);
insert into controllers (name, memory) values (controlle2, 4096);
Here is the xsl i've written so far :
<?xml version="1.0" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xslutput method="text"/>
<xsl:template match="systems">
<xsl:template match="controllers">
insert into controllers (name, memory) values (<xsl:value-of
select="name"/> , <xsl:value-of select="memory"/>);
<xsl:template match="hosts">
insert into hosts (id, name, memory, controller_id) values (<xsl:value-
of select="id"/> , <xsl:value-of select="name"/>, <xsl:value-of
select="memory"/> , <xsl:value-of select="CONTROLLER_Id?"/>);
</xsl:template>
</xsl:template>
</xsl:template>
</xsl:stylesheet>
well as you can see, i don't know how to do such a thing....
any idea?
here is a sample on my xml file :
<systems>
<controllers>
<id>1</id>
<name>controller1</name>
<memory>4096</memory>
<hosts>
<id>1</id>
<name>host1</name>
<memory>256</memory>
<id>2</id>
<name>host2</name>
<memory>256</memory>
</hosts>
<id>2</id>
<name>controller2</name>
<memory>4096</memory>
</controllers>
</systems>
I am trying to write an xsl stylesheet that would generate the
following output :
insert into controllers (name, memory) values (controller1, 4096);
insert into hosts (id, name, memory, controller_id) values (1, host1,
256, 1);
insert into hosts (id, name, memory, controller_id) values (2, host2,
256, 1);
insert into controllers (name, memory) values (controlle2, 4096);
Here is the xsl i've written so far :
<?xml version="1.0" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xslutput method="text"/>
<xsl:template match="systems">
<xsl:template match="controllers">
insert into controllers (name, memory) values (<xsl:value-of
select="name"/> , <xsl:value-of select="memory"/>);
<xsl:template match="hosts">
insert into hosts (id, name, memory, controller_id) values (<xsl:value-
of select="id"/> , <xsl:value-of select="name"/>, <xsl:value-of
select="memory"/> , <xsl:value-of select="CONTROLLER_Id?"/>);
</xsl:template>
</xsl:template>
</xsl:template>
</xsl:stylesheet>
well as you can see, i don't know how to do such a thing....
any idea?