You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xsp-dev@xml.apache.org by Robin Green <gr...@hotmail.com> on 2001/01/16 13:06:29 UTC

Re: cvs commit: xml-cocoon/src/org/apache/cocoon/processor/xsp xsp-java.xsl

I notice even though you subsequently moved most of the tags to util, you've 
left in xsp:variable and you haven't discussed the xsp:variable tag on 
xsp-dev. Seeing as we are about to release 1.8.1, and people might start 
using it thinking it's official, -1 on this.

balld@apache.org wrote:
>balld       01/01/15 22:46:44
>
>   Modified:    src/org/apache/cocoon/processor/xsp xsp-java.xsl
>   Log:
>   added dylan walsh's patch to fix attribute values with double quotes
>   added experimental support for xsp:variable, xsp:generate-method, and 
>xsp:call-method
>
>   Revision  Changes    Path
>   1.24      +85 -1     
>xml-cocoon/src/org/apache/cocoon/processor/xsp/xsp-java.xsl
>
>   Index: xsp-java.xsl
>   ===================================================================
>   RCS file: 
>/home/cvs/xml-cocoon/src/org/apache/cocoon/processor/xsp/xsp-java.xsl,v
>   retrieving revision 1.23
>   retrieving revision 1.24
>   diff -u -r1.23 -r1.24
>   --- xsp-java.xsl	2000/12/10 18:30:07	1.23
>   +++ xsp-java.xsl	2001/01/16 06:46:44	1.24
>   @@ -115,6 +115,23 @@
>    	// Make session object readily available
>            HttpSession session = request.getSession(<xsl:value-of 
>select="$create-session"/>);
>
>   +        <xsl:for-each select="//xsp:variable">
>   +          <xsl:value-of select="@type"/>
>   +          <xsl:text> </xsl:text>
>   +          <xsl:value-of select="@name"/>
>   +          <xsl:text> = </xsl:text>
>   +          <xsl:choose>
>   +            <xsl:when test="@value">
>   +              <xsl:value-of select="@value"/>
>   +            </xsl:when>
>   +            <xsl:otherwise>
>   +              null
>   +            </xsl:otherwise>
>   +          </xsl:choose>
>   +          <xsl:text>;
>   +</xsl:text>
>   +        </xsl:for-each>
>   +
>            <xsl:for-each 
>select="//processing-instruction()[not(starts-with(name(.),'xml-logicsheet') 
>or (starts-with(name(.),'cocoon-process') and contains(.,'xsp')))]">
>              document.appendChild(
>                document.createProcessingInstruction(
>   @@ -260,10 +277,77 @@
>
>        ((Element) xspCurrentNode).setAttribute(
>          "<xsl:value-of select="$attribute-name"/>",
>   -      "<xsl:value-of select="."/>"
>   +      "<xsl:apply-templates select="." mode="Escape"/>"
>        );
>      </xsl:template>
>
>   +  <xsl:template match="@*" mode="Escape">
>   +    <xsl:variable name="backslashEscaped">
>   +      <xsl:call-template name="replace-string">
>   +        <xsl:with-param name="text" select="."/>
>   +        <xsl:with-param name="replace" select="'\'"/>
>   +        <xsl:with-param name="with" select="'\\'"/>
>   +      </xsl:call-template>
>   +    </xsl:variable>
>   +    <xsl:variable name="backslashAndQuotesEscaped">
>   +      <xsl:call-template name="replace-string">
>   +        <xsl:with-param name="text" select="$backslashEscaped"/>
>   +        <xsl:with-param name="replace" select="'&quot;'"/>
>   +        <xsl:with-param name="with" select="'\&quot;'"/>
>   +      </xsl:call-template>
>   +    </xsl:variable>
>   +    <xsl:value-of select="$backslashAndQuotesEscaped"/>
>   +  </xsl:template>
>   +
>   +  <xsl:template name="replace-string">
>   +    <xsl:param name="text"/>
>   +    <xsl:param name="replace"/>
>   +    <xsl:param name="with"/>
>   +    <xsl:choose>
>   +      <xsl:when test="contains($text,$replace)">
>   +        <xsl:value-of select="substring-before($text,$replace)"/>
>   +        <xsl:value-of select="$with"/>
>   +        <xsl:call-template name="replace-string">
>   +          <xsl:with-param name="text" 
>select="substring-after($text,$replace)"/>
>   +          <xsl:with-param name="replace" select="$replace"/>
>   +          <xsl:with-param name="with" select="$with"/>
>   +        </xsl:call-template>
>   +      </xsl:when>
>   +      <xsl:otherwise>
>   +        <xsl:value-of select="$text"/>
>   +      </xsl:otherwise>
>   +    </xsl:choose>
>   +  </xsl:template>
>   +
>   +  <xsl:template match="xsp:variable"/>
>   +
>   +  <xsl:template match="xsp:generate-method-header">
>   +    private <xsl:value-of select="@returns"/>
>   +    <xsl:text> </xsl:text>
>   +    <xsl:value-of select="@name"/> (
>   +      Node xspParentNode,
>   +      Node xspCurrentNode,
>   +      Stack xspNodeStack,
>   +      Document document <xsl:for-each select="//xsp:variable">
>   +        <xsl:text>, </xsl:text>
>   +        <xsl:value-of select="@type"/>
>   +        <xsl:text> </xsl:text>
>   +        <xsl:value-of select="@name"/>
>   +        <xsl:if test="@value">
>   +          <xsl:text> = </xsl:text>
>   +          <xsl:value-of select="@value"/>
>   +        </xsl:if>
>   +      </xsl:for-each>
>   +      ) throws Exception
>   +  </xsl:template>
>   +
>   +  <xsl:template match="xsp:call-method">
>   +    this.<xsl:value-of 
>select="@name"/>(xspParentNode,xspCurrentNode,xspNodeStack,document
>   +    <xsl:for-each select="//xsp:variable">
>   +      ,<xsl:value-of select="@name"/>
>   +    </xsl:for-each>
>   +    )
>   +  </xsl:template>
>
>      <!-- *** Dynamic Tag Support *** -->
>
>
>
>
>
>----------------------------------------------------------------------
>In case of troubles, e-mail:     webmaster@xml.apache.org
>To unsubscribe, e-mail:          cocoon-cvs-unsubscribe@xml.apache.org
>For additional commands, e-mail: cocoon-cvs-help@xml.apache.org
>
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.


Re: cvs commit: xml-cocoon/src/org/apache/cocoon/processor/xsp xsp-java.xsl

Posted by Donald Ball <ba...@webslingerZ.com>.
On Tue, 16 Jan 2001, Robin Green wrote:

> I notice even though you subsequently moved most of the tags to util, you've
> left in xsp:variable and you haven't discussed the xsp:variable tag on
> xsp-dev. Seeing as we are about to release 1.8.1, and people might start
> using it thinking it's official, -1 on this.

er, yes we have had discussion of xsp:variable on xsp-dev... no decision
yet, but i wanted to see how it looked in practice. however, i'm perfectly
happy to take this bit out for the 1.8.1 release. i'd be even happier to
explicitly comment it as <!--EXPERIMENTAL-->... so let me know.

you might want to take out the xsp:expr-value and the
xsp:declare-node-stack stuff if you're cleaning up xsp-java, as they were
added to the c1 xsp implementation with no notice, discussion, or vote.

- donald


Re: cvs commit: xml-cocoon/src/org/apache/cocoon/processor/xsp xsp-java.xsl

Posted by Donald Ball <ba...@webslingerZ.com>.
On Tue, 16 Jan 2001, Robin Green wrote:

> I notice even though you subsequently moved most of the tags to util, you've
> left in xsp:variable and you haven't discussed the xsp:variable tag on
> xsp-dev. Seeing as we are about to release 1.8.1, and people might start
> using it thinking it's official, -1 on this.

er, yes we have had discussion of xsp:variable on xsp-dev... no decision
yet, but i wanted to see how it looked in practice. however, i'm perfectly
happy to take this bit out for the 1.8.1 release. i'd be even happier to
explicitly comment it as <!--EXPERIMENTAL-->... so let me know.

you might want to take out the xsp:expr-value and the
xsp:declare-node-stack stuff if you're cleaning up xsp-java, as they were
added to the c1 xsp implementation with no notice, discussion, or vote.

- donald