DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=12270>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=12270

Not able to transform in-memory documents





------- Additional Comments From [EMAIL PROTECTED]  2002-09-06 19:09 -------
Yes, After I made the changes you recommended I was able to build the in-memory 
document;I wrote this document out to a file whose content is as below:

  <?xml version="1.0" encoding="UTF-8" ?> 
- <orderSystem xmlns:ord="http://www.nicholaschase.com/orders/"; 
xmlns:prod="http://www.nicholaschase.com/products/";>
- <ord:orders>
- <ord:order ord:order_id="9tZjC41e96fZ3">
  <ord:order_status>open</ord:order_status> 
- <ord:item ord:product_id="BR3452">
  <ord:quantity>2</ord:quantity> 
  </ord:item>
  </ord:order>
  </ord:orders>
- <prod:products>
- <prod:vendor prod:webvendor="full">
- <prod:advertisement>
- <prod:ad_sentence>
  Conners Chair Company presents their annual big three day only chair sale. 
We're making way for our new stock! 
  <prod:b>All current inventory must go!</prod:b> 
  Regular prices slashed by up to 60%! 
  </prod:ad_sentence>
  </prod:advertisement>
- <prod:product>
  <prod:product_id>QA3452</prod:product_id> 
  <prod:short_desc>Queen Anne Chair</prod:short_desc> 
  <prod:price prod:pricetype="cost">$85</prod:price> 
  <prod:price prod:pricetype="sale">$125</prod:price> 
  <prod:price prod:pricetype="retail">$195</prod:price> 
  <prod:inventory prod:color="royal blue" 
prod:location="warehouse">12</prod:inventory> 
  <prod:inventory prod:color="royal blue" 
prod:location="showroom">5</prod:inventory> 
  <prod:inventory prod:color="flower print" 
prod:location="warehouse">16</prod:inventory> 
  <prod:inventory prod:color="flower print" 
prod:location="showroom">3</prod:inventory> 
  <prod:inventory prod:color="seafoam green" 
prod:location="warehouse">0</prod:inventory> 
  <prod:inventory prod:color="seafoam green" 
prod:location="showroom">20</prod:inventory> 
  <prod:inventory prod:color="teal" 
prod:location="warehouse">15</prod:inventory> 
  <prod:inventory prod:color="teal" 
prod:location="showroom">14</prod:inventory> 
  <prod:inventory prod:color="burgundy" 
prod:location="showroom">0</prod:inventory> 
- <prod:giveaway>
  <prod:giveaway_item>Matching Ottoman included</prod:giveaway_item> 
  <prod:giveaway_desc>While supplies last</prod:giveaway_desc> 
  </prod:giveaway>
  </prod:product>
- <prod:product>
  <prod:product_id>RC2342</prod:product_id> 
  <prod:short_desc>Early American Rocking Chair</prod:short_desc> 
  <prod:product_desc>with brown and tan plaid upholstery</prod:product_desc> 
  <prod:price prod:pricetype="cost">$75</prod:price> 
  <prod:price prod:pricetype="sale">$62</prod:price> 
  <prod:price prod:pricetype="retail">$125</prod:price> 
  <prod:inventory prod:location="warehouse">40</prod:inventory> 
  <prod:inventory prod:location="showroom">5</prod:inventory> 
  </prod:product>
- <prod:product>
  <prod:product_id>BR3452</prod:product_id> 
  <prod:short_desc>Bentwood Rocker</prod:short_desc> 
  <prod:price prod:pricetype="cost">$125</prod:price> 
  <prod:price prod:pricetype="sale">$160</prod:price> 
  <prod:price prod:pricetype="retail">$210</prod:price> 
  <prod:inventory prod:location="showroom">18</prod:inventory> 
  </prod:product>
  </prod:vendor>
  </prod:products>
  </orderSystem>

I am transforming this document using the following stylesheet and viewing the 
results in the IE browser:

<?xml version="1.0" ?>
<xsl:stylesheet version="1.0"    
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";  
                              
xmlns:prod="http://www.nicholaschase.com/products/";      
                                                          
xmlns:ord="http://www.nicholaschase.com/orders/";>


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

<xsl:template match="ord:item">
    <xsl:value-of select="@ord:product_id" />
        <br />
</xsl:template>  
 
</xsl:stylesheet>

The code which does the transformation is as below:

 TransformerFactory transFactory = TransformerFactory.newInstance();
 Transformer transformer = transFactory.newTransformer(
            new StreamSource(request.getContextPath()+"/ReviewOrder.xsl"));

 transformer.transform(new DOMSource(orderSystem),new StreamResult(out));

The response.contentType was set to text/html right upfront in the servlet. I 
am also using the current version MSXML which I guess is the XSLT engine which 
the IE browser uses. While I expected just the 3 product IDs to e displayed, 
there is an error in the browser and what is displayed on the browser is the 
following:

Invalid at the top level of the document. Error processing 
resource 'http://localhost:7001/shoppingCart/review'. Line 2, Position 1379 
 

<prod:giveaway>
     <prod:giveaway_item>Matching Ottoman included </prod:giveaway_item> 
     <prod:giveaway_desc>While supplies</prod:giveaway_desc>
</prod:giveaway>         </prod:product>         <prod:product>             
<prod:product_id>RC2342</prod:product_id>             <prod:short_desc>Early 
American Rocking Chair</prod:short_desc>             <prod:product_desc>with 
brown and tan plaid upholstery</prod:product_desc>             <prod:price 
prod:pricetype="cost">$75</prod:price>             <prod:price 
prod:pricetype="sale">$62</prod:price>             <prod:price 
prod:pricetype="retail">$125</prod:price>             <prod:inventory 
prod:location="warehouse">40</prod:inventory>             <prod:inventory 
prod:location="showroom">5</prod:inventory>         </prod:product>         
<prod:product>             
<prod:product_id>BR3452</prod:product_id>             <prod:short_desc>Bentwood 
Rocker</prod:short_desc>             <prod:price 
prod:pricetype="cost">$125</prod:price>             <prod:price 
prod:pricetype="sale">$160</prod:price>             <prod:price 
prod:pricetype="retail">$210</prod:price>             <prod:inventory 
prod:location="showroom">18</prod:inventory>         </prod:product>     
</prod:vendor> </prod:products></orderSystem><?xml version="1.0" encoding="UTF-
8"?>

Reply via email to