XSL变量的内存使用情况 [英] XSL variable memory usage

查看:93
本文介绍了XSL变量的内存使用情况的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新来XSLT.I有一个XML文档,我使用XSL在转换XML到HTML table.The XML是从服务器响应网络client.In这种情况下,IE9浏览器。 XSLT处理由浏览器。多个CH3的节点做范围从1到100000。

下面是我在做什么样code。

在下面的xsl code中的变量在每次创建loop.I想知道这是什么创作上的浏览器memory.Also将在有任何性能影响效果?

  ============ xmlDoc中=======
    < XML版本=1.0编码=ISO-8859-1&GT?;
    <根和GT;
    <&CH1 GT;
      < CH2>
       < CH3一个=bosyB =C =5D =没有人/>
        ......     < / CH2>
    < / CH1>
    < /根>     ============ xmlDoc中=======
      ============ XSLSheet =======     < XML版本=1.0编码=ISO-8859-1&GT?;
     < XSL:变换版本=1.0的xmlns:XSL =htt​​p://www.w3.org/1999/XSL/Transform>      <的xsl:模板匹配=根/ CH1>
        ......
      <的xsl:for-每个选择=CH1 / CH>
        < XSL:变量名=色>
         < XSL:选择>
         <的xsl:when测试=@ C =5>橙色< / XSL:当>
          <的xsl:when测试=@ C =4>红色和LT; / XSL:当>
         <的xsl:when测试=@ C ='3'>白色< / XSL:当>
         <的xsl:when测试=@ C ='2'>格力< / XSL:当>
         <的xsl:when测试=@ C ='1'→黄色< / XSL:当>
         <的xsl:when测试=@ C ='0'>蓝色< / XSL:当>
        < / XSL:选择>
       < / XSL:变量>
         .............
     < /的xsl:for-每个>
      .............
      < XSL模板>    < / XSL:变换>      ============ XSL表=======


解决方案

您需要解决的性能自上而下不是自下而上。你知道你的性能要求?你可以衡量你当前正在实现的性能?是否有差距,如果是这样,你可以量化吗?在这个阶段,你就可以开始向下钻取分析原因,例如通过执行受控实验来测量改变在特定的方式设计的效果。作为投机特定结构是否是低效的是这个过程的一部分,但要获得答案的唯一途径是进行测量。

I am new to XSLT.I have an XML document and I am using the XSL for converting the XML in to an HTML table.The XML is response from an server to web client.In this case It is IE9 browser.The XSLT processing is done by browser.The number of "ch3" nodes ranges from 1 to 100000.

Below is the sample code of what I am doing .

In the below xsl code the variable is created in every loop.I like to know what is the effect of this creation on the browser memory.Also will this have any performance impacts?

    ============XMLDoc=======
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <root>
    <ch1>
      <ch2>
       <ch3 a="bosy" b="" c="5" d="nobody"/>
        ......        

     </ch2>
    </ch1>
    </root>

     ============XMLDoc=======
      ============XSLSheet=======

     <?xml version="1.0" encoding="ISO-8859-1"?>
     <xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

      <xsl:template match="root/ch1">
        ......
      <xsl:for-each select="ch1/ch">
        <xsl:variable name="color">
         <xsl:choose>
         <xsl:when test="@c = '5'">orange</xsl:when>
          <xsl:when test="@c = '4'">red</xsl:when>
         <xsl:when test="@c = '3'">white</xsl:when>
         <xsl:when test="@c = '2'">gree</xsl:when>
         <xsl:when test="@c = '1'">yellow</xsl:when>
         <xsl:when test="@c = '0'">blue</xsl:when>
        </xsl:choose>
       </xsl:variable>
         .............
     </xsl:for-each>
      .............
      <xsl-template>

    </xsl:transform>

      ============XSL Sheet=======

解决方案

You need to address performance top-down not bottom-up. Do you know your performance requirements? Can you measure the performance you are currently achieving? Is there a gap, and if so, can you quantify it? At this stage you can start drilling down to analyze the causes, e.g. by doing controlled experiments to measure the effect of changing the design in particular ways. Speculating as to whether particular constructs are inefficient is part of this process, but the only way to get an answer is to make measurements.

这篇关于XSL变量的内存使用情况的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆