Return-Path: Delivered-To: apmail-jakarta-taglibs-dev-archive@jakarta.apache.org Received: (qmail 68977 invoked by uid 500); 26 Sep 2001 07:56:05 -0000 Mailing-List: contact taglibs-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk Reply-To: taglibs-dev@jakarta.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list taglibs-dev@jakarta.apache.org Received: (qmail 68970 invoked from network); 26 Sep 2001 07:56:05 -0000 Received: from smtp010.mail.yahoo.com (216.136.173.30) by daedalus.apache.org with SMTP; 26 Sep 2001 07:56:05 -0000 Received: from pc-62-30-163-97-hw.blueyonder.co.uk (HELO lndevjs) (62.30.163.97) by smtp.mail.vip.sc5.yahoo.com with SMTP; 26 Sep 2001 07:56:17 -0000 X-Apparently-From: Message-ID: <076a01c14660$7a63f360$9865fea9@spiritsoft.com> From: "James Strachan" To: References: <3BABAAC0.9B43BA54@intraware.com> Subject: Re: Adding URIResolver functionality to XTags StyleTag Date: Wed, 26 Sep 2001 08:54:31 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Hi Brian Sorry for the delay getting back to you, I've been on a short vacation and it took a while to catch up. Great idea, using a URIResolver. I've applied your patch, its now in CVS and should make the next nightly build. Thanks! James ----- Original Message ----- From: "Brian Devries" To: Sent: Friday, September 21, 2001 10:01 PM Subject: Adding URIResolver functionality to XTags StyleTag > I have run into a probelm using the style tag when trying to use > includes/imports. I would like to suggest that the StyleTag from xtags > configure the xslt transformer so that it resolves all included and > imported stylesheets in the same way the tag resolves a URI, for > example, through a URL, a relative URL, or a resource. > > Here's the code I've added to my version of xtags: > > public int doEndTag() throws JspException { > if ( xml == null || xsl == null ) { > throw new JspException( "Must specify both XML and an XSLT > to style" ); > } > > // Prepare an input source for the data > Source data = getSource(xml); > > // Prepare an input source for the stylesheet > Source style = getSource(xsl); > > // Prepare an output source for the outputs > Result result = getResult(); > > // Use JAXP to perform the stylesheet > try { > TransformerFactory factory = > TransformerFactory.newInstance(); > factory.setURIResolver(new URIResolver() { > > public Source resolve(String href, String base) > throws TransformerException { > try { > return getSource(href); > } > catch(javax.servlet.jsp.JspException e) { > return null; > } > } > > }); > Transformer transformer = factory.newTransformer(style); > configure(transformer); > transformer.transform( data, result ); > if ( stringWriter != null ) { > pageContext.getOut().write( stringWriter.toString() ); > } > } > catch (TransformerException e) { > handleException(e); > } > catch (IOException e) { > handleException(e); > } > finally { > stringWriter = null; > } > return EVAL_PAGE; > } > > -Brian De Vries > > -- > Brian De Vries -- Sr. Software Engineer > mailto:bdevries@intraware.com http://www.intraware.com > Voice: 925.253.6516 Fax: 925.253.4542 > ------------------------------------------------------- > Intraware...Control Your Technology > _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com