I figured it out, my XSL now looks like the following:

<?xml version="1.0"?>

<xsl:stylesheet
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
    xmlns:ns0="http://www.circuitcity.com/rtvcrms";
    version="1.0">
    <xsl:output method="text" />

    <xsl:template match="/">
        <xsl:apply-templates />
    </xsl:template>

    <xsl:template match="ns0:notificationHeader">
        <xsl:apply-templates select="ns0:notificationDetails" />
    </xsl:template>

    <xsl:template match="ns0:notificationDetails">
        <xsl:apply-templates select="ns0:notificationDetail" />
    </xsl:template>

    <xsl:template match="ns0:notificationDetail">
        <xsl:value-of select="normalize-space(ns0:rtvShipDate)" />
        <xsl:text>,</xsl:text>
        <xsl:value-of select="normalize-space(ns0:brand)" />
        <xsl:text>,</xsl:text>
        <xsl:value-of select="normalize-space(ns0:model)" />
        <xsl:text>,</xsl:text>
        <xsl:value-of select="normalize-space(ns0:qtyDiscrepancy)" />
        <xsl:text>,</xsl:text>
        <xsl:value-of select="normalize-space(ns0:requestedAmount)" />
        <xsl:text>,</xsl:text>
        <xsl:value-of select="normalize-space(ns0:paidAmount)" />
        <xsl:text>,</xsl:text>
        <xsl:value-of select="normalize-space(ns0:rejectedAmount)" />
        <xsl:text>,</xsl:text>
        <xsl:value-of select="normalize-space(ns0:epPrice)" />
        <xsl:text>,</xsl:text>
        <xsl:value-of select="normalize-space(ns0:ppRec)" />
        <xsl:text>,</xsl:text>
        <xsl:value-of select="normalize-space(ns0:message)" />
        <xsl:text>,</xsl:text>
        <xsl:value-of select="normalize-space(ns0:repaycode)" />
        <xsl:text>,</xsl:text>
        <xsl:value-of select="normalize-space(ns0:vendorNumber)" />
        <xsl:text>,</xsl:text>
        <xsl:value-of select="normalize-space(ns0:discrepancyAmount)" />
        <xsl:text>,</xsl:text>
        <xsl:value-of select="normalize-space(ns0:rtvPrice)" />
        <xsl:text>,</xsl:text>
        <xsl:value-of select="normalize-space(ns0:cmPrice)" />
        <xsl:text>,</xsl:text>
        <xsl:value-of select="normalize-space(ns0:rrPrice)" />
        <xsl:text>,</xsl:text>
        <xsl:value-of select="normalize-space(ns0:defTag)" />
        <xsl:text>,</xsl:text>
        <xsl:value-of select="normalize-space(ns0:apCost)" />
        <xsl:text>,</xsl:text>
        <xsl:value-of select="normalize-space(ns0:invoiceCost)" />
        <xsl:text>,</xsl:text>
        <xsl:value-of select="normalize-space(ns0:funding)" />
        <xsl:text>,</xsl:text>
        <xsl:value-of select="normalize-space(ns0:earned)" />
        <xsl:text>,</xsl:text>
        <xsl:value-of select="normalize-space(ns0:cmNumber)" />
        <xsl:text>,</xsl:text>
        <xsl:value-of select="normalize-space(ns0:rtvNumber)" />
        <xsl:text>,</xsl:text>
        <xsl:value-of select="normalize-space(ns0:keyRecNo)" />
        <xsl:text>&#10;</xsl:text>
    </xsl:template>
</xsl:stylesheet>


And it works like a champ.

On 8/22/07, Ronald R. DiFrango <[EMAIL PROTECTED]> wrote:
>
> OK, I figured out part of the problem, it seems I need to force Xalan or
> the parser to recognize namespaces.  How do I go about doing that?
>
> On 8/22/07, Ronald R. DiFrango <[EMAIL PROTECTED]> wrote:
> >
> > All,
> >
> > I have the following XML:
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <ns0:notificationHeader xmlns:ns0=" http://www.circuitcity.com/rtvcrms
> > ">
> >     <ns0:id>81</ns0:id>
> >     <ns0:vendorNumber>70229</ns0:vendorNumber>
> >     <ns0:recepientAddress/>
> >     
> > <ns0:notificationDate>2007-06-08T21:01:28.959-04:00</ns0:notificationDate>
> >
> >     <ns0:subject>CCS RTV Payment Disputes 06/08/2007
> > 21:01:28</ns0:subject>
> >     <ns0:body>N/A</ns0:body>
> >     <ns0:retryCount>1</ns0:retryCount>
> >     <ns0:comment>N/A</ns0:comment>
> >     <ns0:status>Sent</ns0:status>
> >     <ns0:rtvNumber>35508077</ns0:rtvNumber>
> >     <ns0:notificationDetails>
> >         <ns0:notificationDetail>
> >             <ns0:id>19</ns0:id>
> >             <ns0:rtvShipDate>2004-03-22T00:00:00-05:00</ns0:rtvShipDate>
> >             <ns0:qtyDiscrepancy>0</ns0:qtyDiscrepancy>
> >             <ns0:requestedAmount>870</ns0:requestedAmount>
> >             <ns0:paidAmount>500</ns0:paidAmount>
> >             <ns0:rejectedAmount>370</ns0:rejectedAmount>
> >             <ns0:epPrice>0</ns0:epPrice>
> >             <ns0:message>According to our Vendor Contract, this
> > additional charge is not authorized for repayment OR was
> > overbilled.</ns0:message>
> >             <ns0:repaycode>RS</ns0:repaycode>
> >             <ns0:vendorNumber>70229</ns0:vendorNumber>
> >             <ns0:discrepancyAmount>0</ns0:discrepancyAmount>
> >             <ns0:rtvPrice>0</ns0:rtvPrice>
> >             <ns0:cmPrice>0</ns0:cmPrice>
> >             <ns0:rrPrice>0</ns0:rrPrice>
> >             <ns0:defTag>-</ns0:defTag>
> >             <ns0:apCost>0</ns0:apCost>
> >             <ns0:invoiceCost>0</ns0:invoiceCost>
> >             <ns0:funding>Y</ns0:funding>
> >             <ns0:earned>Y</ns0:earned>
> >             <ns0:cmNumber>35508077CM</ns0:cmNumber>
> >             <ns0:rtvNumber>35508077</ns0:rtvNumber>
> >         </ns0:notificationDetail>
> >     </ns0:notificationDetails>
> > </ns0:notificationHeader>
> >
> > and the following XSL file:
> >
> > <xsl:stylesheet version="1.0" xmlns:xsl="
> > http://www.w3.org/1999/XSL/Transform ">
> > <xsl:output method="text"/>
> > <xsl:template match="notificationDetail">
> > <xsl:value-of select="normalize-space(rtvShipDate)"/> , <xsl:value-of
> > select="normalize-space(brand)"/> , <xsl:value-of
> > select="normalize-space(model)"/> , <xsl:value-of
> > select="normalize-space(qtyDiscrepancy)"/> , <xsl:value-of
> > select="normalize-space(requestedAmount)"/> , <xsl:value-of
> > select="normalize-space(paidAmount)"/> , <xsl:value-of
> > select="normalize-space(rejectedAmount)"/> , <xsl:value-of
> > select="normalize-space(epPrice)"/> , <xsl:value-of
> > select="normalize-space(ppRec)"/> , <xsl:value-of
> > select="normalize-space(message)"/> , <xsl:value-of
> > select="normalize-space(repaycode)"/> , <xsl:value-of
> > select="normalize-space(vendorNumber)"/> , <xsl:value-of
> > select="normalize-space(discrepancyAmount)"/> , <xsl:value-of
> > select="normalize-space(rtvPrice)"/> , <xsl:value-of
> > select="normalize-space(cmPrice)"/> , <xsl:value-of
> > select="normalize-space(rrPrice)"/> , <xsl:value-of
> > select="normalize-space(defTag)"/> , <xsl:value-of
> > select="normalize-space(apCost)"/> , <xsl:value-of
> > select="normalize-space(invoiceCost)"/> , <xsl:value-of
> > select="normalize-space(funding)"/> , <xsl:value-of
> > select="normalize-space(earned)"/> , <xsl:value-of
> > select="normalize-space(cmNumber)"/> , <xsl:value-of
> > select="normalize-space(rtvNumber)"/> , <xsl:value-of
> > select="normalize-space(keyRecNo)"/><xsl:text>&#10;</xsl:text>
> > </xsl:template>
> > </xsl:stylesheet>
> >
> >
> > The intent is for me is to transform the XML into a CSV format.  But
> > when I run this stylesheet I get the following:
> >
> >
> >     81
> >     70229
> >
> >     2007-06-08T21:01:28.959-04:00
> >     CCS RTV Payment Disputes 06/08/2007 21:01:28
> >     N/A
> >     1
> >     N/A
> >     Sent
> >     35508077
> >
> >
> >             19
> >             2004-03-22T00:00:00-05:00
> >             0
> >             870
> >             500
> >             370
> >             0
> >             According to our Vendor Contract, this additional charge is
> > not authorized for repayment OR was overbilled.
> >             RS
> >             70229
> >             0
> >             0
> >             0
> >             0
> >             -
> >             0
> >             0
> >             Y
> >             Y
> >             35508077CM
> >             35508077
> >
> >
> > Which is basically a flat dump of the XML minus the tags.  My execution
> > code is as follows:
> >
> > public static void main(String[] args) throws Exception {
> >         StreamSource xsl = new StreamSource(new InputStreamReader(
> > NotificationTransform.class.getResourceAsStream("convertToCSV.xsl" )));
> >         Transformer transformer = TransformerFactory.newInstance
> > ().newTransformer(xsl);
> >         StreamSource xml = new StreamSource(new
> > FileReader("C:/Temp/xmlOutput/notificationDetails.xml"));
> >         StreamResult result = new StreamResult(new
> > FileWriter("C:/Temp/xmlOutput/notificationDetails.txt"));
> >         transformer.transform(xml, result);
> >         // System.out.println("Done: " + result.getWriter().toString());
> >     }
> >
> > Any help would be appreciated.
> >
> > Ron
> >
>
>

Reply via email to