[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.2

XSL Performance

Asked by peterxlane in Extensible Markup Language (XML)

Tags: xsl, performance

I am building a website using ASP, XML, and XSL to learn more about these technologies.  I have come up with a way of accessing ASP variables within my XSL templates and this allows me to call different templates based on different conditions.  This allows me to greatly simplify my ASP code in that all it really has to do is transform one XML file into XHTML, but it can produce many different results based on values passed in the querystring.  Everything seems to work fine, I am just wondering about performance down the road as the application grows as well as future projects.

Does an xsl file that has multiple xsl include files have to "process" all of these templates even if they are not being used at that particular time.  In other words, if I have something like what is shown below, will I end up with poor performance?

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:import href="one.xsl"/>
<xsl:import href="two.xsl"/>
<xsl:import href="three.xsl"/>
<xsl:import href="four.xsl"/>
<xsl:import href="five.xsl"/>

<xsl:template match="/foo">


<xsl:choose>
        <xsl:when test="$strOperation = 'this'">
            <xsl:call-template name="one" />
        </xsl:when>
        <xsl:when test="$strOperation = 'that'">
              <xsl:call-template name="two" />
        </xsl:when>
        <xsl:when test="$strOperation = 'something'">
            <xsl:call-template name="three" />
        </xsl:when>
        <xsl:when test="$strOperation = 'somevalue'">
              <xsl:call-template name="four" />
        </xsl:when>
        <xsl:otherwise>
            <xsl:call-template name="five"/>
        </xsl:otherwise>
</xsl:choose>

</xsl:template>

</xsl:stylesheet>



The second part of my question involves the use of the "msxsl:node-set" function.  My site has an administration piece that allows me to edit the content of various entries.  Some of the content on the site needs to only be visible to the administrator (which I can detect in a variable in my XSL).  So my xml data would look something like this:

<post>
   <approved>True</approved>
   <entry>this is sample data</entry>
</post>
<post>
   <approved>False</approved>
   <entry>this is sample data also</entry>
</post>

When I display this data on a page, I would want it to be visible to the admin (as well as display additional buttons, etc).  This occurs in different sections all over the site.  My thought was to create a variable containing the XML to be used which is different based on whether the user is logged in as the admin or not.  So it would look something like this:

<xsl:variable name="SiteXML">
<xsl:choose>
   <xsl:when test="$blnLoggedIn = 'True'">

<!--everything is included-->
<post>
   <approved>True</approved>
   <entry>this is sample data</entry>
</post>
<post>
   <approved>False</approved>
   <entry>this is sample data also</entry>
</post>

   </xsl:when>
   <xsl:otherwise>
<!--only approved items are included-->
<post>
   <approved>True</approved>
   <entry>this is sample data</entry>
</post>

   </xsl:otherwise>
</xsl:choose>

</xsl:variable>


Then I only have to maintain one XSL stylesheet for this portion, by using this variable as my source data, by doing this:

<xsl:for-each select="msxsl:node-set($SiteXML)">
   display stuff here
</xsl:for-each>


This whole thing was done simply for me to learn more about XML and XSL, so I just want to make sure I am not totally off track by going about things this way, and I figured I could get some constructive criticism here.

      
[+][-]02/10/06 03:55 PM, ID: 15928086Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zone: Extensible Markup Language (XML)
Tags: xsl, performance
Sign Up Now!
Solution Provided By: rdcpro
Participating Experts: 1
Solution Grade: A
 
[+][-]02/10/06 03:58 PM, ID: 15928099Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02/10/06 03:59 PM, ID: 15928103Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03/03/06 02:35 PM, ID: 16099254Administrative Comment

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 30-day free trial to view this Administrative Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091111-EE-VQP-89