Return-Path: X-Original-To: apmail-camel-users-archive@www.apache.org Delivered-To: apmail-camel-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 2C4ED4B57 for ; Wed, 8 Jun 2011 03:09:28 +0000 (UTC) Received: (qmail 44677 invoked by uid 500); 8 Jun 2011 03:09:27 -0000 Delivered-To: apmail-camel-users-archive@camel.apache.org Received: (qmail 44643 invoked by uid 500); 8 Jun 2011 03:09:27 -0000 Mailing-List: contact users-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@camel.apache.org Delivered-To: mailing list users@camel.apache.org Received: (qmail 44635 invoked by uid 99); 8 Jun 2011 03:09:26 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 08 Jun 2011 03:09:26 +0000 X-ASF-Spam-Status: No, hits=1.8 required=5.0 tests=MISSING_MID,RCVD_IN_BRBL_LASTEXT,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [218.240.155.146] (HELO tongtech.com) (218.240.155.146) by apache.org (qpsmtpd/0.29) with SMTP; Wed, 08 Jun 2011 03:09:22 +0000 Received: from tongxhb (unknown [218.240.156.210]) by tongtech.com with CMailServer 5.3 SMTP; Wed, 08 Jun 2011 11:09:46 +0800 From: "ext2" To: Subject: Re: A problem of XSLT Date: Wed, 8 Jun 2011 11:08:54 +0800 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook, Build 11.0.5510 In-Reply-To: <4DEDE66B.2050606@gmail.com> Thread-Index: Acwk8DGcriRvxT/sRKuAhKtmlrjC5AAkW09w X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3664 Message-Id: <20110608030926.8BB876B5@athena.apache.org> Hi, Jiang: I just got the answer from apache xalan mail-list. You can check it; Following is the apache xalan's response: >Sender: Christoffer Dam Bruun [mailto:cdbruun@flyingpigs.dk] >Date: 2011/6/6 17:52 >Receiver: xalan-j-users@xml.apache.org >Subject: Re: a question of DOMSource >If your xpath expressions starts with '/' e.g. '/Records/Record' then you need >a document If you are >transforming a "sub" element you cannot start with '/' e.g. '/Record' but must >use 'Record' >Best regards >Christoffer Bruun >>On 04-06-2011 07:07, ext2 wrote: >>Hi: >>When I using Xalan 2.7.1 to transform a DOM Source; >>I find that:The Node combine with DOMSource must be a Document and It cannot >>be just a Element; >>Does anyone know if this limit is correctly or wrong, and why? >>Following is a simple program to illustrate it >>Document doc = DocumentBuilder.parse(.) >>//if I using document as input, the result is correct; >>Transformer.transform(new DOMSource(doc), streamResult); >>//but if I using element as input, the result is wrong; >>Transformer.transform(new DOMSource(doc.getDocumentElement), streamResult); >> >>Ps: xml xslt I used: >>Xml: >> >> >>a >>b >>c >> >>Xslt: >>It's too long, but it logical is very simple, just exchange field content2 >>& content 3; >>And I am sure it's correctly, because I have use a StreamSource(xml-stream), >>and Document 's DOMSource as input, their result both are correctly; >>but if anyone interest with it, I can post it in reply; > -----original ----- >Sender: Willem Jiang [mailto:willem.jiang@gmail.com] >Date: 2011/6/7 16:51 >Receiver: users@camel.apache.org >Subject: Re: A problem of XSLT > > As you can't tell if there are some problems in your XSLT template, > can you write a simple java code to call transformer yourself? > > On 6/4/11 12:38 PM, ext2 wrote: > > Hi: > > > > Recently I am using camel xslt to do xml transform; > > > > If the xslt processor's input is a xml string, the transform result is > > correct; > > > > But if the xslt processor's input is a org.w3c.xml.Node which is build from > > the exactly same xml string; then thing's will be very strange: > > > > If I using the latest sun's JAXP implementation , a exception (Namespace for > > prefix has not been declared) always occurs; and if I switch to apache > > xalan 2.7.1,the transform result is just a empty document; > > > > Actually, I think this problem is the XSLT engine's reason; > > But after I explorer the source code of xalan, I find it seems xalan always > > ask for the input DOM Node should be a document container. I am not sure if > > this limit is a bug or a correct thing; > > Do anyone know it? > > > > If the limit is correctly, Maybe the camel XSLT processor should wrapper a > > DOM with a DocumentFragment, then build a DOMSource of DocumentFragment as > > XSLT's input; > > But if the limit is xslt engine bug, maybe we should waiting from xalan or > > sun to correct this; > > > > > > Ps: route& xml& xslt; > > Route:( same route from DOM input& xml string input) > > > > > > > > > > a > > b > > c > > > > > > Successful result: > > > > > > a > > c > > b > > > > > > Xslt: > > .....it's too long, and I am sure it's correct....; > > > > > > > > > -- > Willem > ---------------------------------- > FuseSource > Web: http://www.fusesource.com > Blog: http://willemjiang.blogspot.com (English) > http://jnn.javaeye.com (Chinese) > Twitter: willemjiang > Weibo: willemjiang