Bill,
It will make it easier on us if your sample XML is well formed, and contains
the content that results in your sample output. The XML you provided isn't
well formed, and doesn't contain the text values you are showing in your
sample output.
Guessing as to what was in your sample input XML that results in your
output, I am thinking you had something like this:
<EntireOrder>
<PO>
<POHeader>
<SomeHeaderInfo1>Steve</SomeHeaderInfo1>
<SomeHeaderInfo2>555-5555</SomeHeaderInfo2>
</POHeader>
<POLine>
<SomeOtherLineInfo>100</SomeOtherLineInfo>
<SomeLineInfo2>Tags</SomeLineInfo2>
<SomeLineInfo3>10</SomeLineInfo3>
<SomeLineInfo4>1000</SomeLineInfo4>
<ShipTo>
<ShipInfo1>Walmart</ShipInfo1>
</ShipTo>
</POLine>
<POLine>
<SomeOtherLineInfo>100</SomeOtherLineInfo>
<SomeLineInfo2>Tags</SomeLineInfo2>
<SomeLineInfo3>10</SomeLineInfo3>
<SomeLineInfo4>1000</SomeLineInfo4>
<ShipTo>
<ShipInfo1>Walmart</ShipInfo1>
</ShipTo>
</POLine>
</PO>
</EntireOrder>
However, I would then expect you to have "Walmart" appearing twice in your
output, and in your post it appears only once....
That aside, this might do what you're looking for:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="/">
<Orders>
<xsl:for-each select="EntireOrder/PO/POLine">
<Order>
<ShipToCustomer>
<xsl:apply-templates select="ShipTo/ShipInfo1"/>
</ShipToCustomer>
<Description>
<xsl:apply-templates select="SomeLineInfo2"/>
</Description>
<Quantity>
<xsl:apply-templates select="SomeOtherLineInfo"/>
</Quantity>
<Buyer>
<xsl:apply-templates
select="../POHeader/SomeHeaderInfo1"/>
</Buyer>
<Phone>
<xsl:apply-templates
select="../POHeader/SomeHeaderInfo2"/>
</Phone>
<UnitPrice>
<xsl:apply-templates select="SomeLineInfo3"/>
</UnitPrice>
<Total>
<xsl:apply-templates select="SomeLineInfo4"/>
</Total>
</Order>
</xsl:for-each>
</Orders>
</xsl:template>
</xsl:stylesheet>
The above stylesheet applied to the corrected XML I pasted above yields:
<Orders>
<Order>
<ShipToCustomer>Walmart</ShipToCustomer>
<Description>Tags</Description>
<Quantity>100</Quantity>
<Buyer>Steve</Buyer>
<Phone>555-5555</Phone>
<UnitPrice>10</UnitPrice>
<Total>1000</Total>
</Order>
<Order>
<ShipToCustomer>Walmart</ShipToCustomer>
<Description>Tags</Description>
<Quantity>100</Quantity>
<Buyer>Steve</Buyer>
<Phone>555-5555</Phone>
<UnitPrice>10</UnitPrice>
<Total>1000</Total>
</Order>
</Orders>
Hope that helps,
...sam
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--