justuskenney
Technical User
I'm trying to create a XSL to read in this XML Document. I do fine with the cus_id, po_number, but i have trouble with item(s). Please help. Thanks, Jay
<Utrecht>
<PurchaseOrder>
<cus_id>UTC</cus_id>
<po_number>46027</po_number>
<trx_type>A</trx_type>
<vendor_id>1502</vendor_id>
<change_no>1</change_no>
<name>Sona Enterprises</name>
<address_1>7825 Somerset Blvd.</address_1>
<address_2>Unit D</address_2>
<region_2>Paramount</region_2>
<region_1>CA</region_1>
<postal_code>90723</postal_code>
<country>USA</country>
<area_code>562</area_code>
<phone>6333002</phone>
<fax_area_code>800</fax_area_code>
<fax>5757662</fax>
<location>9</location>
<item>
<item_no>50501</item_no>
<vendor_item_no>717BD-USA</vendor_item_no>
<unit_price>11.2100</unit_price>
<qty_order>45</qty_order>
<extended_price>504.4500</extended_price>
<due_date>20040122</due_date>
</item>
<item>
<item_no>50502</item_no>
<vendor_item_no>730NF</vendor_item_no>
<unit_price>0.6300</unit_price>
<qty_order>50</qty_order>
<extended_price>31.5000</extended_price>
<due_date>20040122</due_date>
</item>
<item>
<item_no>50503</item_no>
<vendor_item_no>7295NFC</vendor_item_no>
<unit_price>1.3500</unit_price>
<qty_order>50</qty_order>
<extended_price>67.5000</extended_price>
<due_date>20040122</due_date>
</item>
<item>
<item_no>50504</item_no>
<vendor_item_no>763WB</vendor_item_no>
<unit_price>0.3600</unit_price>
<qty_order>40</qty_order>
<extended_price>14.4000</extended_price>
<due_date>20040122</due_date>
</item>
</PurchaseOrder>
</Utrecht>
This is what I have so far
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl=" <xsl:template match="/">
<html>
<body>
<xsl:for-each select="Utrecht/PurchaseOrder">
<xsl:value-of select="cus_id"/>
<xsl:value-of select="po_number"/>
<xsl:value-of select="trx_type"/>
<xsl:value-of select="vendor_id"/>
<xsl:value-of select="name"/>
<xsl:value-of select="location"/>
<xsl:value-of select="Utrecht/PurchaseOrder/item/item_no"/>
</xsl:for-each>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
<Utrecht>
<PurchaseOrder>
<cus_id>UTC</cus_id>
<po_number>46027</po_number>
<trx_type>A</trx_type>
<vendor_id>1502</vendor_id>
<change_no>1</change_no>
<name>Sona Enterprises</name>
<address_1>7825 Somerset Blvd.</address_1>
<address_2>Unit D</address_2>
<region_2>Paramount</region_2>
<region_1>CA</region_1>
<postal_code>90723</postal_code>
<country>USA</country>
<area_code>562</area_code>
<phone>6333002</phone>
<fax_area_code>800</fax_area_code>
<fax>5757662</fax>
<location>9</location>
<item>
<item_no>50501</item_no>
<vendor_item_no>717BD-USA</vendor_item_no>
<unit_price>11.2100</unit_price>
<qty_order>45</qty_order>
<extended_price>504.4500</extended_price>
<due_date>20040122</due_date>
</item>
<item>
<item_no>50502</item_no>
<vendor_item_no>730NF</vendor_item_no>
<unit_price>0.6300</unit_price>
<qty_order>50</qty_order>
<extended_price>31.5000</extended_price>
<due_date>20040122</due_date>
</item>
<item>
<item_no>50503</item_no>
<vendor_item_no>7295NFC</vendor_item_no>
<unit_price>1.3500</unit_price>
<qty_order>50</qty_order>
<extended_price>67.5000</extended_price>
<due_date>20040122</due_date>
</item>
<item>
<item_no>50504</item_no>
<vendor_item_no>763WB</vendor_item_no>
<unit_price>0.3600</unit_price>
<qty_order>40</qty_order>
<extended_price>14.4000</extended_price>
<due_date>20040122</due_date>
</item>
</PurchaseOrder>
</Utrecht>
This is what I have so far
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl=" <xsl:template match="/">
<html>
<body>
<xsl:for-each select="Utrecht/PurchaseOrder">
<xsl:value-of select="cus_id"/>
<xsl:value-of select="po_number"/>
<xsl:value-of select="trx_type"/>
<xsl:value-of select="vendor_id"/>
<xsl:value-of select="name"/>
<xsl:value-of select="location"/>
<xsl:value-of select="Utrecht/PurchaseOrder/item/item_no"/>
</xsl:for-each>
</body>
</html>
</xsl:template>
</xsl:stylesheet>