EDN Admin
Well-known member
Fiel name : CDS.xml
<?xml version="1.0" encoding="ISO-8859-1"?> <catalog> <cd> <package>A</package> <id>1</id> <title>Empire Burlesque</title> <artist>Bob Dylan</artist> <country>USA</country> <company>Columbia</company>
<price>10.90</price> <year>1985</year> </cd> <cd> <package>A</package> <id>1</id> <title>Hide your heart</title> <artist>Bonnie Tyler</artist> <country>UK</country>
<company>CBS Records</company> <price>9.90</price> <year>1988</year> </cd> <cd> <package>B</package> <id>1</id> <title>Greatest Hits</title> <artist>Dolly Parton</artist>
<country>USA</country> <company>RCA</company> <price>9.90</price> <year>1982</year> </cd> <cd> <package>B</package> <id>2</id> <title>Still got the blues</title>
<artist>Gary Moore</artist> <country>UK</country> <company>Virgin records</company> <price>10.20</price> <year>1990</year> </cd> <cd> <package>B</package> <id>3</id>
<title>Eros</title> <artist>Eros Ramazzotti</artist> <country>EU</country> <company>BMG</company> <price>9.90</price> <year>1997</year> </cd> <cd> <package>A</package>
<id>2</id> <title>One night only</title> <artist>Bee Gees</artist> <country>UK</country> <company>Polydor</company> <price>10.90</price> <year>1998</year> </cd> <cd>
<package>A</package> <id>3</id> <title>Sylvias Mother</title> <artist>Dr.Hook</artist> <country>UK</country> <company>CBS</company> <price>8.10</price> <year>1973</year>
</cd> <cd> <package>A</package> <id>4</id> <title>Maggie May</title> <artist>Rod Stewart</artist> <country>UK</country> <company>Pickwick</company> <price>8.50</price>
<year>1990</year> </cd> <cd> <package>A</package> <id>2</id> <title>Romanza</title> <artist>Andrea Bocelli</artist> <country>EU</country> <company>Polydor</company>
<price>10.80</price> <year>1996</year> </cd> </catalog>
File Name : Cds.xsl
<?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform <xsl:template match="/ <html> <body> My CD Collection <table border="1
<tr bgcolor="#9acd32 <th>Package</th> <th>ID</th> <th>Title</th> <th>Artist</th> </tr> <xsl:for-each select="catalog/cd <tr> <td><xsl:value-of select="package"/></td>
<td><xsl:value-of select="id"/></td> <td><xsl:value-of select="title"/></td> <td><xsl:value-of select="artist"/></td> </tr> </xsl:for-each> </table> </body> </html> </xsl:template>
</xsl:stylesheet>
This is the out put
<?xml version="1.0" encoding="UTF-16"?><br/>
<catalog><br/>
<cd><br/>
<package>A</package><br/>
<id>1</id><br/>
<title>Empire Burlesque</title><br/>
<artist>Bob Dylan</artist><br/>
</cd><br/>
<cd><br/>
<package>A</package><br/>
<id>1</id><br/>
<br/>
<title>Hide your heart</title><br/>
<artist>Bonnie Tyler</artist><br/>
</cd><br/>
<cd><br/>
<package>B</package><br/>
<id>1</id><br/>
<title>Greatest Hits</title><br/>
<artist>Dolly Parton</artist><br/>
</cd><br/>
<cd><br/>
<package>B</package><br/>
<br/>
<id>2</id><br/>
<title>Still got the blues</title><br/>
<artist>Gary Moore</artist><br/>
</cd><br/>
<cd><br/>
<package>B</package><br/>
<id>3</id><br/>
<title>Eros</title><br/>
<artist>Eros Ramazzotti</artist><br/>
</cd><br/>
<br/>
<cd><br/>
<package>A</package><br/>
<id>2</id><br/>
<title>One night only</title><br/>
<artist>Bee Gees</artist><br/>
</cd><br/>
<cd><br/>
<package>A</package><br/>
<id>3</id><br/>
<title>Sylvias Mother</title><br/>
<br/>
<artist>Dr.Hook</artist><br/>
</cd><br/>
<cd><br/>
<package>A</package><br/>
<id>4</id><br/>
<title>Maggie May</title><br/>
<artist>Rod Stewart</artist><br/>
</cd><br/>
<cd><br/>
<package>A</package><br/>
<id>2</id><br/>
<br/>
<title>Romanza</title><br/>
<artist>Andrea Bocelli</artist><br/>
</cd><br/>
</catalog><br/>
<br/>
---------------------------------------------------------------------------------
Wht i need is, i need to replace "ids"(of output) with "New IDs" of below xml
i have a new file called "New_IDs.xml"
<?xml version="1.0" encoding="ISO-8859-1"?> <catalog> <ids> <package>A</package> <id>1</id> <newId>A-1001</newId> </ids> <ids> <package>A</package> <id>2</id> <newId>A-1002</newId>
</ids> <ids> <package>A</package> <id>3</id> <newId>A-1003</newId> </ids> <ids> <package>A</package> <id>4</id> <newId>A-1004</newId> </ids> <ids> <package>B</package>
<id>1</id> <newId>B-1001</newId> </ids> <ids> <package>B</package> <id>2</id> <newId>B-1002</newId> </ids> <ids> <package>B</package> <id>3</id> <newId>B-1003</newId>
</ids> <ids> <package>B</package> <id>4</id> <newId>B-1005</newId> </ids> </catalog>
Hoping your help<br/>
View the full article
<?xml version="1.0" encoding="ISO-8859-1"?> <catalog> <cd> <package>A</package> <id>1</id> <title>Empire Burlesque</title> <artist>Bob Dylan</artist> <country>USA</country> <company>Columbia</company>
<price>10.90</price> <year>1985</year> </cd> <cd> <package>A</package> <id>1</id> <title>Hide your heart</title> <artist>Bonnie Tyler</artist> <country>UK</country>
<company>CBS Records</company> <price>9.90</price> <year>1988</year> </cd> <cd> <package>B</package> <id>1</id> <title>Greatest Hits</title> <artist>Dolly Parton</artist>
<country>USA</country> <company>RCA</company> <price>9.90</price> <year>1982</year> </cd> <cd> <package>B</package> <id>2</id> <title>Still got the blues</title>
<artist>Gary Moore</artist> <country>UK</country> <company>Virgin records</company> <price>10.20</price> <year>1990</year> </cd> <cd> <package>B</package> <id>3</id>
<title>Eros</title> <artist>Eros Ramazzotti</artist> <country>EU</country> <company>BMG</company> <price>9.90</price> <year>1997</year> </cd> <cd> <package>A</package>
<id>2</id> <title>One night only</title> <artist>Bee Gees</artist> <country>UK</country> <company>Polydor</company> <price>10.90</price> <year>1998</year> </cd> <cd>
<package>A</package> <id>3</id> <title>Sylvias Mother</title> <artist>Dr.Hook</artist> <country>UK</country> <company>CBS</company> <price>8.10</price> <year>1973</year>
</cd> <cd> <package>A</package> <id>4</id> <title>Maggie May</title> <artist>Rod Stewart</artist> <country>UK</country> <company>Pickwick</company> <price>8.50</price>
<year>1990</year> </cd> <cd> <package>A</package> <id>2</id> <title>Romanza</title> <artist>Andrea Bocelli</artist> <country>EU</country> <company>Polydor</company>
<price>10.80</price> <year>1996</year> </cd> </catalog>
File Name : Cds.xsl
<?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform <xsl:template match="/ <html> <body> My CD Collection <table border="1
<tr bgcolor="#9acd32 <th>Package</th> <th>ID</th> <th>Title</th> <th>Artist</th> </tr> <xsl:for-each select="catalog/cd <tr> <td><xsl:value-of select="package"/></td>
<td><xsl:value-of select="id"/></td> <td><xsl:value-of select="title"/></td> <td><xsl:value-of select="artist"/></td> </tr> </xsl:for-each> </table> </body> </html> </xsl:template>
</xsl:stylesheet>
This is the out put
<?xml version="1.0" encoding="UTF-16"?><br/>
<catalog><br/>
<cd><br/>
<package>A</package><br/>
<id>1</id><br/>
<title>Empire Burlesque</title><br/>
<artist>Bob Dylan</artist><br/>
</cd><br/>
<cd><br/>
<package>A</package><br/>
<id>1</id><br/>
<br/>
<title>Hide your heart</title><br/>
<artist>Bonnie Tyler</artist><br/>
</cd><br/>
<cd><br/>
<package>B</package><br/>
<id>1</id><br/>
<title>Greatest Hits</title><br/>
<artist>Dolly Parton</artist><br/>
</cd><br/>
<cd><br/>
<package>B</package><br/>
<br/>
<id>2</id><br/>
<title>Still got the blues</title><br/>
<artist>Gary Moore</artist><br/>
</cd><br/>
<cd><br/>
<package>B</package><br/>
<id>3</id><br/>
<title>Eros</title><br/>
<artist>Eros Ramazzotti</artist><br/>
</cd><br/>
<br/>
<cd><br/>
<package>A</package><br/>
<id>2</id><br/>
<title>One night only</title><br/>
<artist>Bee Gees</artist><br/>
</cd><br/>
<cd><br/>
<package>A</package><br/>
<id>3</id><br/>
<title>Sylvias Mother</title><br/>
<br/>
<artist>Dr.Hook</artist><br/>
</cd><br/>
<cd><br/>
<package>A</package><br/>
<id>4</id><br/>
<title>Maggie May</title><br/>
<artist>Rod Stewart</artist><br/>
</cd><br/>
<cd><br/>
<package>A</package><br/>
<id>2</id><br/>
<br/>
<title>Romanza</title><br/>
<artist>Andrea Bocelli</artist><br/>
</cd><br/>
</catalog><br/>
<br/>
---------------------------------------------------------------------------------
Wht i need is, i need to replace "ids"(of output) with "New IDs" of below xml
i have a new file called "New_IDs.xml"
<?xml version="1.0" encoding="ISO-8859-1"?> <catalog> <ids> <package>A</package> <id>1</id> <newId>A-1001</newId> </ids> <ids> <package>A</package> <id>2</id> <newId>A-1002</newId>
</ids> <ids> <package>A</package> <id>3</id> <newId>A-1003</newId> </ids> <ids> <package>A</package> <id>4</id> <newId>A-1004</newId> </ids> <ids> <package>B</package>
<id>1</id> <newId>B-1001</newId> </ids> <ids> <package>B</package> <id>2</id> <newId>B-1002</newId> </ids> <ids> <package>B</package> <id>3</id> <newId>B-1003</newId>
</ids> <ids> <package>B</package> <id>4</id> <newId>B-1005</newId> </ids> </catalog>
Hoping your help<br/>
View the full article