You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Ronnie Bahlsten <rb...@globecom.se> on 2001/04/04 09:56:12 UTC

Efficiency of xsl:element

Hi !

I was wondering if there is a reason at all to use:

<xsl:element name="TABLE">
    <xsl:attribute name="border">0</xsl:attribute>
... more attributes.
    <xsl:more-nested-elements-here>
    <xsl:value-of select="@data"/>
</xsl:element>

Instead of just using the straightforward html
<table border="0">
<tr>
<td><xsl:value-of select="@data"/>

Is there a performance consideration to be done here ?
Anyone have experience ?

/ Ronnie


  ----- Original Message ----- 
  From: Sharath Chandra 
  To: cocoon-users@xml.apache.org 
  Sent: Wednesday, April 04, 2001 6:25 PM
  Subject: Re: Calling different XSL


  vineet,
  I dont know if this is an efficient way to do , but it worked for me. I am giving the user the option of choosing the format (PDF, HTML...)
  The XML say A refers to a XSL say B and this xsl resolves the parameter passed (  and inturn copies the xsl of the requested format and applies the processor.)
   
   
   
  <?xml version="1.0"?>
  <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
   
   <!-- this is internal reference to the "format" in the url -->
   <xsl:param name="format"/>
   
   <xsl:template match="/">
    <xsl:choose>
     <xsl:when test="$format=1">
      <xsl:processing-instruction name="xml-stylesheet">href="format_acrobat.xsl"  type="text/xsl"</xsl:processing-instruction>
      <xsl:processing-instruction name="cocoon-process">type="xslt"</xsl:processing-instruction>
     </xsl:when>
   
     <xsl:otherwise>
      <xsl:processing-instruction name="xml-stylesheet">href="format_html.xsl" type="text/xsl"</xsl:processing-instruction>
      <xsl:processing-instruction name="cocoon-process">type="xslt"</xsl:processing-instruction>
  </xsl:otherwise>
    </xsl:choose>
   
      <xsl:apply-templates/>
   
   </xsl:template>
   
   <!-- copy everyting else except processing instructions; be careful if you need them...-->
   
  <xsl:template match="@*|*|text">
      <xsl:copy>
        <xsl:apply-templates select="@*|*|text"/>
      </xsl:copy>
    </xsl:template>
  </xsl:stylesheet>
   
  Again, this may not be the best way but it is a quick fix.
   
   
   
   
   
  _______________________________________________________________________________
                                                  
       I can do all things through Christ Jesus who strengthens me.
                                                                                  (Holy Bible)
                                                                                    Phil 4:13
  ___________________________________
   

  K.Sharath Chandra,
  Software Engineer,
  Amsoft Systems India Inc.,
  4, Munirka Marg,
  New Delhi - 57
  INDIA.
  ============
    ----- Original Message ----- 
    From: Vineet Arora 
    To: cocoon-users@xml.apache.org 
    Sent: Wednesday, April 04, 2001 1:43 AM
    Subject: Calling different XSL


    Hello ,
    This mail is regarding my problem to call different XSL's.
    Actually what i want  is to submit to user a form with different options regarding in what form i.e XML,PDF,HTML
    does he want the output to be displayed to him.
    When the user selects an option that is caught by me in an XSP page using request.getParameter() method.Now depending on the option selected by the user i want to call the corresponding stylesheet that generates XML,PDF or HTML.Can anyone help me in this regard.
     
    Regards,
    Vineet Arora
    varora@ggn.aithent.com