cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mustafa Yalniz" <yal...@bluewin.ch>
Subject Re: escaping characters
Date Thu, 24 Jul 2003 09:37:21 GMT
My pipeline looks like as below.

      <map:match pattern="vipresource-sunrise-newuser">
        <map:generate src="vip/resources/sunrise-newuser-db.xml"/>
        <map:transform type="sunShine"/>
        <map:transform src="vip/styles/sunrise-newuser-db.xsl"/>
        <map:transform type="sql"/>
        <map:transform src="vip/styles/sunrise-newuser-sql.xsl"/>
        <map:serialize type="xml"/>
      </map:match>

sunrise-newuser-db.xml is below.

<?xml version="1.0"?> <!-- sunrise-newuser-db.xml -->

<adduser xmlns:sunshine="http://cocoon.apache.org/sunshine/1.0">
  <name><sunshine:getxml context="request" path="/parameter/ID"/></name>
...
  <lastname><sunshine:getxml context="request" path="/parameter/lastname"/></lastname>
...
</adduser>

And sunrise-newuser-db.xsl is below.

<?xml version="1.0"?> <!-- sunrise-newuser-db.xsl -->
<xsl:stylesheet version="1.0"
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="adduser">
  <adduser>
    <sql:execute-query xmlns:sql="http://apache.org/cocoon/SQL/2.0">
      <sql:use-connection>vip_db</sql:use-connection>
      <sql:query>
        insert into user_tb
           set name = '<xsl:value-of select="name"/>',
               password = '<xsl:value-of select="password"/>',
               role = '<xsl:value-of select="role"/>',
               title = '<xsl:value-of select="title"/>',
               firstname = '<xsl:value-of select="firstname"/>',
               lastname = '<xsl:value-of select="lastname"/>',
               company = '<xsl:value-of select="company"/>',
               street = '<xsl:value-of select="street"/>',
               zipcode = '<xsl:value-of select="zipcode"/>',
               city = '<xsl:value-of select="city"/>',
               country = '<xsl:value-of select="country"/>',
               phone = '<xsl:value-of select="phone"/>',
               fax = '<xsl:value-of select="fax"/>',
               email = '<xsl:value-of select="email"/>',
               bankid = '<xsl:value-of select="bankid"/>',
               bankname = '<xsl:value-of select="bankname"/>',
               accountid = '<xsl:value-of select="accountid"/>'
      </sql:query>
    </sql:execute-query>
  </adduser>
</xsl:template>

</xsl:stylesheet>

Best regards,
Mustafa


At 16:09 23.07.2003 -0400, you wrote:






  You need to provide us more information for us to really help.  There are
  many ways to solve your particular issue, but how to solve it depends a
  great deal on what your pipeline looks like (i.e., what tools are available
  to us along the way - Java, XSLT, SQLTransformer, etc.).  The fragment you
  show has you creating a query apparently in XSLT, which doesn't provide
  very easy ways to do string manipulation (although it can be done).
  Perhaps if we knew what part of cocoon you are using for the actual
  database work we'd be able to offer you a better solution.  If you are in
  an XSP page, you can write a java function.  If you are using
  SQLTransformer, you may be able to structure your query in XML so that the
  escaping will be done for you.  Etc.

  -Christopher



  |---------+---------------------------->
  |         |           Mustafa Yalniz   |
  |         |           <yalniz@bumed.org|
  |         |           .tr>             |
  |         |                            |
  |         |           07/23/2003 02:51 |
  |         |           PM               |
  |         |           Please respond to|
  |         |           users            |
  |         |                            |
  |---------+---------------------------->
    >--------------------------------------------------------------------------------------------------------------|
    |                                                                                    
                         |
    |       To:       users@cocoon.apache.org                                            
                         |
    |       cc:                                                                          
                         |
    |       Subject:  Re: escaping characters                                            
                         |
    >--------------------------------------------------------------------------------------------------------------|





  I get the info lets say lastname (Irish name could cause problem) from

     <lastname><sunshine:getxml context="request"
  path="/parameter/lastname"/></lastname>

  and apply sunshine transformer.

  later I insert it into the database as below.

           insert into user_tb
              set name = '<xsl:value-of select="name"/>',
                 ...
                  lastname = '<xsl:value-of select="lastname"/>'

  And the lastname has syntax error in case last name is e.g. O'Reilly.

  My question is is there a way in cocoon to process and replace the
  characters with escape ones.

  Mustafa




  ---------------------------------------------------------------------
  To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
  For additional commands, e-mail: users-help@cocoon.apache.org

Mime
View raw message