I would like to build an xml document. I have a certain format it should be in.
Code:
<?xml version="1.0" encoding="utf-8"?>
<AmazonEnvelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="amzn-envelope.xsd">
<?xml-stylesheet type="text/xsl" href="xslt.xsl"?>
<Header>
<DocumentVersion>1.01</DocumentVersion>
<MerchantIdentifier>XYZ</MerchantIdentifier></Header>
<MessageType>Override</MessageType>
<Message>
<MessageID>1</MessageID><OperationType>Update</OperationType>
<Override><SKU>1234</SKU>
<ShippingOverride><ShipOption>Std Cont US Street Addr</ShipOption><Type>Exclusive</Type><ShipAmount currency="USD">0.00</ShipAmount></ShippingOverride>
<ShippingOverride><ShipOption>Std Cont US PO Box</ShipOption><Type>Exclusive</Type><ShipAmount currency="USD">0.00</ShipAmount></ShippingOverride>
</Override>
</Message>
</AmazonEnvelope>
I would like to repeat the </Message> block over and over and have the <SKU> element populated by another XML document I made. It is a simple XML document to house the 'SKU' element.
Code:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Row>
<Column1>5235</Column1>
</Row>
<Row>
<Column1>5211</Column1>
</Row>
<Row>
<Column1>5231</Column1>
</Row>
<Row>
<Column1>1365</Column1>
</Row>...
</Root>
This is my attempt at XSLT...
Code:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes"/>
<xsl:variable name="plUrl" select="string(SKUlist.xml')" />
<xsl:variable name="plDoc" select="document($plUrl)" />
<xsl:variable name="packlist" select="$plDoc/Root" />
<xsl:template match="/">
<xsl:for-each select="$packlist[ROW]">
<Message>
<MessageID>1</MessageID><OperationType>Update</OperationType>
<Override><SKU><xsl:value-of select="Column1"/></SKU>
<ShippingOverride><ShipOption>Std Cont US Street Addr</ShipOption><Type>Exclusive</Type><ShipAmount currency="USD">0.00</ShipAmount></ShippingOverride>
<ShippingOverride><ShipOption>Std Cont US PO Box</ShipOption><Type>Exclusive</Type><ShipAmount currency="USD">0.00</ShipAmount></ShippingOverride>
</Override>
</Message>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
I am creating in txt editor and viewing this in Firefox browser.
It's not working. Any help would be appreciated. Seems a simple process.