You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by an...@apache.org on 2003/10/29 17:37:39 UTC

cvs commit: cocoon-lenya/src/webapp/lenya/xslt/util redirect-document.xsl

andreas     2003/10/29 08:37:39

  Added:       src/webapp/lenya/content/util redirect-document.xsp
               src/webapp/lenya/xslt/util redirect-document.xsl
  Log:
  added redirect-document XSP and XSLT
  
  Revision  Changes    Path
  1.1                  cocoon-lenya/src/webapp/lenya/content/util/redirect-document.xsp
  
  Index: redirect-document.xsp
  ===================================================================
  <?xml version="1.0" encoding="ISO-8859-1"?>
  
  <!--
  Redirect to a certain document.
  Parameters:
  
    - document-id (defaults to current document id)
    - document-area (defaults to current area)
    - language
    
  -->
  
  <xsp:page
         language="java"
         xmlns:xsp="http://apache.org/xsp"
         xmlns:session="http://apache.org/cocoon/session/1.0"
         xmlns:input="http://apache.org/cocoon/xsp/input/1.0"
         xmlns:xsp-request="http://apache.org/xsp/request/2.0"
         >
  
  <xsp:structure>
    <xsp:include>org.apache.lenya.cms.publication.DocumentHelper</xsp:include>
  </xsp:structure>
  
  <redirect>
    <xsp:logic>
      try {
      
        String documentId = parameters.getParameter("document-id", null);
        String area = parameters.getParameter("area", null);
        String language = parameters.getParameter("language", null);
        
        DocumentHelper helper = new DocumentHelper(objectModel);
        String url = helper.getDocumentUrl(documentId, area, language);
        
        <xsp:attribute name="url"><xsp:expr>url</xsp:expr></xsp:attribute>
      }
      catch (Exception e) {
          throw new ProcessingException(e);
      }
    </xsp:logic>
  
  </redirect>
  
  </xsp:page>
  
  
  1.1                  cocoon-lenya/src/webapp/lenya/xslt/util/redirect-document.xsl
  
  Index: redirect-document.xsl
  ===================================================================
  <?xml version="1.0" encoding="UTF-8" ?>
  
  <!--
      Document   : redirect.xsl
      Created on : 20. Mai 2003, 12:11
      Author     : andreas
      Description:
          Purpose of transformation follows.
  -->
  
  <xsl:stylesheet version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      xmlns="http://www.w3.org/1999/xhtml"
      >
  
  <xsl:template match="/redirect">
    <html>
      <head>
        <meta http-equiv="Refresh" content="0;url={@url}"/>
      </head>
      <body>
      </body>
    </html>
  </xsl:template>
  
  </xsl:stylesheet> 
  
  
  

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