You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Thangadurai <du...@siptech.co.in> on 2003/02/04 13:16:18 UTC

[PATCH] for Issue# 7946

Hi All, 
    This is Thangadurai from SIP Technologies & Exports Ltd, I have attempted to fulfill the enhancement request (bug# 7946) which is in open state. Please find the attached patch for the issue. 

        Issueid -             7946   

        Description -    Adding a new attribute to xsl:output (e.g. debug ) which would cause all <template match=""> invocation to emit a comment into the resulting tree. For ex,

               xml:
                    <testtag/>

                xsl:
                    ...
                    <xsl:template match="testtag">
                      <h1>tralala</h1>
                    </xsl:template>

                generated html:
                    <!-- testtag:beg -->
                    <h1>tralala</h1>
                    <!-- testtag:end -->

    Fix:

            A new optional boolean attribute 'debug' is added for the xsl:output. The value of the debug attribute causes the emition of the comments for all the <template match> invocation in the resulting tree. Addition of the new attribute in the xsl:output requires updation in the following classes.

    i)  javax.xml.transform.OutputKeys (Added new key DEBUG with the value 'debug')

    ii) org.apache.xalan.templates.OutputProperties ( The method 'isLegalPropertyKey(String key)' is updated  to specify the vlaue of the OutputKeys.DEBUG as a legal property for the xsl:output)

    iii) org.apache.xalan.processor.ProcessorOutputElem ( Added setter method for the debug attribute)

    iv) org.apache.xalan.processor.XSLTSchema (Added XSLTAttributeDef for the debug attribute)    

            In the transformation process, the value of the 'debug' attribute is checked before emitting the comments in the resulting tree,  and it has been done in the following methods.

    i) org.apache.xalan.transformer.TransformerImpl 

            - The method applyTemplateToNode(ElemTemplateElement xslInstruction, ElemTemplate template, int child)

    ii) org.apache.xalan.templates.ElemApplyTemplates 

            - The method transformSelectedNodes(TransformerImpl transformer)

 I would be happy if you let me know the status of the patch after review. 
  

Thanks & regards, 
- Thangadurai 
SIP Technologies & Exports Ltd. 


RE: [PATCH] for Issue# 7946

Posted by Joseph Kesselman <ke...@us.ibm.com>.
>That sounds really handy, I'm very keen to see it!

OK, I'll try to finish off the article and get it posted some time soon. 
The stylesheet itself is working; I just need to document it better so 
folks know how to adapt it for their own needs. It isn't a new concept, 
but there haven't been a lot of examples published.

______________________________________
Joe Kesselman  / IBM Research


RE: [PATCH] for Issue# 7946

Posted by Mark Weaver <ma...@npsl.co.uk>.
That sounds really handy, I'm very keen to see it!

Thanks,

Mark

> -----Original Message-----
> From: Joseph Kesselman [mailto:keshlam@us.ibm.com]
> Sent: 04 February 2003 14:31
> To: xalan-dev@xml.apache.org
> Subject: Re: [PATCH] for Issue# 7946
>
>
> Can I vote -.5 on this proposed patch? It's not a bad concept,
> but I don't
> think it's the right answer.
>
> The requested behavior can be obtained _without_ modifying Xalan by
> writing a stylesheet that preprocesses your stylesheet to add that
> behavior to each template. And the annotation-via-stylesheet approach can
> be made more selective about where it generates these comments, and more
> flexible about what it puts into them.
>
>  I've got an example of that approach running at home, which I've been
> meaning to write up for publication.
>
> So I'm not entirely convinced that it makes sense to add code (and to
> spend cycles testing this flag) in core Xalan to support this feature,
> rather than simply documenting how to use styled stylesheets to achieve
> the same thing.
>
> ______________________________________
> Joe Kesselman  / IBM Research
>
>


Re: [PATCH] for Issue# 7946

Posted by Joseph Kesselman <ke...@us.ibm.com>.
Can I vote -.5 on this proposed patch? It's not a bad concept, but I don't 
think it's the right answer.

The requested behavior can be obtained _without_ modifying Xalan by 
writing a stylesheet that preprocesses your stylesheet to add that 
behavior to each template. And the annotation-via-stylesheet approach can 
be made more selective about where it generates these comments, and more 
flexible about what it puts into them.

 I've got an example of that approach running at home, which I've been 
meaning to write up for publication.

So I'm not entirely convinced that it makes sense to add code (and to 
spend cycles testing this flag) in core Xalan to support this feature, 
rather than simply documenting how to use styled stylesheets to achieve 
the same thing.

______________________________________
Joe Kesselman  / IBM Research