[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Correct use of Parameters?

Subject: Correct use of Parameters?
From: "Lopez, William" <william.lopez@xxxxxxx>
Date: Wed, 4 Sep 2002 15:32:35 -0500
xsl transform businessentity
Hello all:

I'm using 2 parameters (probably could have used xsl:variables...) to store
values that are referenced more than once while performing XSLT. My question
is: Is this more efficient (better practice) than walking the nodes each
time? I've included the xml and the pertinent xsl statements.

Thanks,
-Will

************** XML ***********************************
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet  type="text/xsl" href="../xsl/routecodemaintlookup.xsl" ?>
<RouteCodeMaintLookup
   servletPath="test">
   <SearchCriteria
     businessEntityName="LIBERTY MUTUAL" 
     routeCode="RC1"
     userID="xzs3h2"/>
   <RouteCodeList 
     listComplete="N"
     numberOfItems="1">     
     <RouteCodeItem 
       lineNumber="1"
       objectID="0:0:0:1"
       routeCodeID="RC1"
       routeCodeDescription="RC1 Description XXXX">
       <Team 
	     objectID="0:0:0:2"
	     teamID="TM1"
		 teamName="Team1">
	     <BusinessUnit
	       objectID="0:0:0:3"
		   businessUnitID="BU1"
		   businessUnitName="Biz Unit 1">
		 </BusinessUnit>
	   </Team>
	 </RouteCodeItem>
   </RouteCodeList>
</RouteCodeMaintLookup>

******************** XSL ************************************
[snip]
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.1">
<xsl:param name="userID"
select="/RouteCodeMaintLookup/SearchCriteria/@userID"/>
<xsl:param name="businessEntityName"
select="/RouteCodeMaintLookup/SearchCriteria/@businessEntityName"/>
<xsl:output method="html" doctype-public="-//W3C//DTD HTML 4.0//EN" />


[snip]
<xsl:template match="/">
.
.
</
<xsl:template match="RouteCodeMaintLookup">
.
.
</
<xsl:template match="SearchCriteria">
.
.  
      <TD VALIGN="MIDDLE" ALIGN="LEFT">
         <FONT SIZE="2">
           <NOBR>
            <xsl:value-of select="$businessEntityName"/>  
           </NOBR>
          </FONT>
      </TD>
.
.
        <INPUT ID="BusinessEntity" TYPE="HIDDEN" NAME="hfBusinessEntity">
             <xsl:attribute name="value"><xsl:value-of
select="$businessEntityName"/></xsl:attribute>
.
.
        <INPUT ID="userID" TYPE="TEXT" NAME="txtUserID"  SIZE="8"
MAXLENGTH="8" TABINDEX="1">
                <xsl:attribute name="value"><xsl:value-of
select="$userID"/></xsl:attribute>
             </INPUT>

One more thing...Is there a better way to write this?
<xsl:value-of
select="/RouteCodeMaintLookup/RouteCodeList/RouteCodeItem/Team/BusinessUnit/
@businessUnitName"/> 

Looking at the XML, all the BusinessUnit info is in the next node- what I
mean by better is shorter...a more compact version.

TIA

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.