=20
> many thanks for your reply. We are using Saxon 8.7.1.
This would explain why Saxon didn't detect the use of conflicting =
NamePools
- that check was added in 8.8.
> Unfortunately the class net.sf.saxon.dom.DocumentBuilderImpl=20
> does not provide a setConfiguration method.
> Is this method a 8.8 feature?
Yes, I suspect it was added to make it possible to run everything under =
a
single Configuration. Can I suggest that you move forward?
Michael Kay
http://www.saxonica.com/
>=20
> Many thanks for your help
>=20
> Urs
>=20
> Michael Kay wrote:
> > Saxon is actually getting stricter in checking that you use=20
> not only=20
> > the same NamePool, but the same Configuration for multiple=20
> documents=20
> > used in a single transformation. I'm a little surprised=20
> that this one=20
> > wasn't caught - are you using Saxon 8.8?
> >
> > If you use the JAXP DocumentBuilderFactory, you can achieve this by=20
> > the sequence
> >
> > DocumentBuilderFactory lFactory =3D=20
> > DocumentBuilderFactory.newInstance();
> > DocumentBuilder builder =3D lfactory.newDocumentBuilder();=20
> > ((DocumentBuilderImpl)builder).setConfiguration(
> > =20
> ((TransformerFactoryImpl)sTransformerFactory).getConfiguration());
> >
> > This isn't particularly nice, because the need to cast to=20
> > Saxon-specific types rather spoils the point of using JAXP=20
> interfaces.=20
> > It would be better, as you suggest, to make it possible to=20
> achieve this using setAttribute().
> >
> > Michael Kay
> > http://www.saxonica.com/
> >
> >
> >
> > =20
> >> -----Original Message-----
> >> From: saxon-help-bounces@...
> >> [mailto:saxon-help-bounces@...] On Behalf Of Urs=20
> >> Tanner
> >> Sent: 23 November 2006 16:16
> >> To: saxon-help@...
> >> Subject: [saxon] How can we use our own instance of a=20
> NamePool in the=20
> >> Saxon XSLT processor and copy nodes from a Saxon DOM with=20
> >> xsl:copy-of?
> >>
> >> Hello
> >>
> >> we have the following issue:
> >>
> >> Due to memory issues, we cannot use the default NamePool=20
> in the Saxon=20
> >> XSLT-Transformer
> >>
> >> Therefore, we create a transformer using following java code:
> >>
> >> net.sf.saxon.om.NamePool sNamePool =3D new=20
> >> net.sf.saxon.om.NamePool();
> >> sTransformerFactory =3D TransformerFactory.newInstance();
> >> =20
> >>=20
> sTransformerFactory.setAttribute(net.sf.saxon.FeatureKeys.NAME_POOL,
> >> sNamePool);
> >>
> >> This works very nice. However, in some style-sheets we call a Java=20
> >> Extension that returns a Node that represent some SVG.
> >>
> >> <xsl:variable name=3D"*BarChartResult*"=20
> >> select=3D"*barcharting:getSVG($BarChartID, $BarChartName,=20
> >> $BarChartType, $LOCALE, $PrintLegend, $CategoryAxisLabel,=20
> >> $ValueAxisLabel, $Height, $Width, $ColorModel, $UseSpotColors,=20
> >> $AltChartingXML, $DFChartingImageFormat,=20
> $DFChartingImageResolution,=20
> >> $OnErrorAbort)*" />
> >> =20
> >> This node is added to the transformer result using following XSLT:
> >>
> >> <xsl:copy-of select=3D"*$BarChartResult*" />
> >>
> >> The Node returned from the Java Extension is an instance=20
> of a Saxon=20
> >> Node containing Nodes from the SVG namespace.
> >>
> >> When we run this style sheet, we get an=20
> IllegalArgumentException from=20
> >> Saxon, saying 'Unknown name code xxxx'.
> >>
> >> java.lang.IllegalArgumentException: Unknown name code 1747 at
> >> net.sf.saxon.om.NamePool.unknownNameCode(NamePool.java:745)
> >> at net.sf.saxon.om.NamePool.getURI(NamePool.java:578)
> >> at
> >> net.sf.saxon.event.ComplexContentOutputter.namespace(ComplexCo
> >> ntentOutputter.java:213)
> >> at
> >> net.sf.saxon.tinytree.TinyElementImpl.sendNamespaceDeclaration
> >> s(TinyElementImpl.java:79)
> >> at
> >>=20
> net.sf.saxon.tinytree.TinyElementImpl.copy(TinyElementImpl.java:324)
> >> at net.sf.saxon.instruct.CopyOf.processLeavingTail(CopyOf.java:134)
> >> at
> >> net.sf.saxon.expr.LetExpression.processLeavingTail(LetExpressi
> >> on.java:329)
> >> at net.sf.saxon.instruct.Block.processLeavingTail(Block.java:336)
> >> at
> >> net.sf.saxon.expr.LetExpression.processLeavingTail(LetExpressi
> >> on.java:329)
> >> at net.sf.saxon.instruct.Block.processLeavingTail(Block.java:336)
> >> at net.sf.saxon.instruct.Instruction.process(Instruction.java:91)
> >> at net.sf.saxon.expr.LetExpression.process(LetExpression.java:203)
> >> at
> >> net.sf.saxon.instruct.ElementCreator.processLeavingTail(Elemen
> >> tCreator.java:164)
> >> at net.sf.saxon.instruct.Block.processLeavingTail(Block.java:336)
> >> at net.sf.saxon.instruct.Instruction.process(Instruction.java:91)
> >> at
> >> net.sf.saxon.instruct.ElementCreator.processLeavingTail(Elemen
> >> tCreator.java:164)
> >> at net.sf.saxon.instruct.Block.processLeavingTail(Block.java:336)
> >> at net.sf.saxon.instruct.Instruction.process(Instruction.java:91)
> >> at
> >> net.sf.saxon.instruct.ElementCreator.processLeavingTail(Elemen
> >> tCreator.java:164)
> >> at net.sf.saxon.instruct.Block.processLeavingTail(Block.java:336)
> >> at
> >> net.sf.saxon.expr.LetExpression.processLeavingTail(LetExpressi
> >> on.java:329)
> >> at net.sf.saxon.instruct.Block.processLeavingTail(Block.java:336)
> >> at
> >> net.sf.saxon.expr.LetExpression.processLeavingTail(LetExpressi
> >> on.java:329)
> >> at net.sf.saxon.instruct.Block.processLeavingTail(Block.java:336)
> >> at net.sf.saxon.instruct.Instruction.process(Instruction.java:91)
> >> at
> >> net.sf.saxon.instruct.ElementCreator.processLeavingTail(Elemen
> >> tCreator.java:164)
> >> at net.sf.saxon.instruct.Block.processLeavingTail(Block.java:336)
> >> at
> >> net.sf.saxon.expr.LetExpression.processLeavingTail(LetExpressi
> >> on.java:329)
> >> at net.sf.saxon.instruct.Block.processLeavingTail(Block.java:336)
> >> at
> >> net.sf.saxon.expr.LetExpression.processLeavingTail(LetExpressi
> >> on.java:329)
> >> at net.sf.saxon.instruct.Block.processLeavingTail(Block.java:336)
> >> at net.sf.saxon.instruct.Instruction.process(Instruction.java:91)
> >> at
> >> net.sf.saxon.instruct.ElementCreator.processLeavingTail(Elemen
> >> tCreator.java:164)
> >> at net.sf.saxon.instruct.Block.processLeavingTail(Block.java:336)
> >> at net.sf.saxon.instruct.Instruction.process(Instruction.java:91)
> >> at
> >> net.sf.saxon.instruct.ElementCreator.processLeavingTail(Elemen
> >> tCreator.java:164)
> >> at net.sf.saxon.instruct.Block.processLeavingTail(Block.java:336)
> >> at
> >> net.sf.saxon.expr.LetExpression.processLeavingTail(LetExpressi
> >> on.java:329)
> >> at net.sf.saxon.instruct.Block.processLeavingTail(Block.java:336)
> >> at net.sf.saxon.instruct.Block.processLeavingTail(Block.java:336)
> >> at net.sf.saxon.instruct.Instruction.process(Instruction.java:91)
> >> at
> >> net.sf.saxon.instruct.ElementCreator.processLeavingTail(Elemen
> >> tCreator.java:164)
> >> at net.sf.saxon.instruct.Instruction.process(Instruction.java:91)
> >> at
> >> net.sf.saxon.instruct.ElementCreator.processLeavingTail(Elemen
> >> tCreator.java:164)
> >> at net.sf.saxon.instruct.Block.processLeavingTail(Block.java:336)
> >> at net.sf.saxon.instruct.Instruction.process(Instruction.java:91)
> >> at
> >> net.sf.saxon.instruct.ElementCreator.processLeavingTail(Elemen
> >> tCreator.java:164)
> >> at net.sf.saxon.instruct.Block.processLeavingTail(Block.java:336)
> >> at net.sf.saxon.instruct.Instruction.process(Instruction.java:91)
> >> at
> >> net.sf.saxon.instruct.ElementCreator.processLeavingTail(Elemen
> >> tCreator.java:164)
> >> at net.sf.saxon.instruct.Block.processLeavingTail(Block.java:336)
> >> at
> >> net.sf.saxon.expr.LetExpression.processLeavingTail(LetExpressi
> >> on.java:329)
> >> at net.sf.saxon.instruct.Block.processLeavingTail(Block.java:336)
> >> at net.sf.saxon.instruct.Instruction.process(Instruction.java:91)
> >> at
> >> net.sf.saxon.instruct.ElementCreator.processLeavingTail(Elemen
> >> tCreator.java:164)
> >> at
> >> net.sf.saxon.expr.LetExpression.processLeavingTail(LetExpressi
> >> on.java:329)
> >> at net.sf.saxon.instruct.Block.processLeavingTail(Block.java:336)
> >> at net.sf.saxon.instruct.Instruction.process(Instruction.java:91)
> >> at
> >> net.sf.saxon.instruct.ElementCreator.processLeavingTail(Elemen
> >> tCreator.java:164)
> >> at net.sf.saxon.instruct.Block.processLeavingTail(Block.java:336)
> >> at net.sf.saxon.instruct.Template.expand(Template.java:108)
> >> at=20
> net.sf.saxon.instruct.Template.applyLeavingTail(Template.java:92)
> >> at
> >> net.sf.saxon.instruct.ApplyTemplates.applyTemplates(ApplyTempl
> >> ates.java:319)
> >> at net.sf.saxon.Controller.transformDocument(Controller.java:1561)
> >> at net.sf.saxon.Controller.transform(Controller.java:1389)
> >>
> >>
> >> We tried to add the same NamePool (sNamePool) to the=20
> >> DocumentBuilderFactory using following Java Code:
> >>
> >> DocumentBuilderFactory lFactory =3D=20
> >> DocumentBuilderFactory.newInstance(); // returns an instance of=20
> >> net.sf.saxon.dom.DocumentBuilderFactoryImpl
> >> =20
> >> lFactory.setAttribute(net.sf.saxon.FeatureKeys.NAME_POOL,=20
> sNamePool);
> >>
> >> Unfortunately the DocumentBuilderFactory returns an=20
> >> IllegalArgumentException.
> >>
> >> java.lang.IllegalArgumentException: Unrecognized=20
> attribute name:=20
> >> http://saxon.sf.net/feature/namePool
> >> at
> >> net.sf.saxon.dom.DocumentBuilderFactoryImpl.setAttribute(Docum
> >> entBuilderFactoryImpl.java:26)
> >>
> >> Question: How can we use our own instance of a NamePool in=20
> the Saxon=20
> >> XSLT processor and copy nodes from a Saxon DOM with xsl:copy-of?
> >>
> >> Many thanks for your help
> >>
> >>
> >> Urs
> >>
> >>
> >> --------------------------------------------------------------
> >> -----------
> >> Take Surveys. Earn Cash. Influence the Future of IT Join=20
> >> SourceForge.net's Techsay panel and you'll get the chance to share=20
> >> your opinions on IT & business topics through brief surveys - and=20
> >> earn cash=20
> >> http://www.techsay.com/default.php?page=3Djoin.php&p=3Dsourceforge
> >> &CID=3DDEVDEV
> >> _______________________________________________
> >> saxon-help mailing list
> >> saxon-help@...
> >> https://lists.sourceforge.net/lists/listinfo/saxon-help
> >> =20
> >
> >
> >
> > =20
>=20
> --
> Beste Gr=FCsse / Kind regards
>=20
> Urs Tanner
>=20
> Assentis Technologies AG
> Lettenstr. 8, 6343 Rotkreuz, Switzerland
>=20
> Web : http://www.assentis.com
> MailTo : urs.tanner@...
> Mobile : +41-79-341 77 07
> Phone : +41-41-790 91 92
> SkypeIn: +41-44-586 66 96
> Skype : urs.tanner
>=20
> This e-mail, any associated files and the information=20
> contained in the e-mail might be confidential and are=20
> intended for the addressee(s) only. Any unauthorised use,=20
> disclosure, alteration or any other use of this message is=20
> prohibited and might be unlawful. Any views or opinions=20
> expressed in this e-mail are those of the sender and do not=20
> necessarily represent those of the company. Neither Assentis=20
> Technologies nor the sender accept any responsibility for any=20
> kind of damage as the result of viruses or transmission problems.
>=20
>=20
> --------------------------------------------------------------
> -----------
> Take Surveys. Earn Cash. Influence the Future of IT Join=20
> SourceForge.net's Techsay panel and you'll get the chance to=20
> share your opinions on IT & business topics through brief=20
> surveys - and earn cash=20
> http://www.techsay.com/default.php?page=3Djoin.php&p=3Dsourceforge
&CID=3DDEVDEV
> _______________________________________________
> saxon-help mailing list
> saxon-help@...
> https://lists.sourceforge.net/lists/listinfo/saxon-help
|