Thanks Michael!
-----Original Message-----
From: Michael Kay [mailto:michael(_dot_)h(_dot_)kay(_at_)ntlworld(_dot_)com]
Sent: Wednesday, January 08, 2003 5:01 AM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: RE: [xsl] Best practice for "walking" node
The following axis is in general very expensive, like "//" you should
avoid it if you can.
In this situation I would probably write
../WorkGroupCollection/WorkGroup, because order with this kind of data
usually isn't significant.
Michael Kay
Software AG
home: Michael(_dot_)H(_dot_)Kay(_at_)ntlworld(_dot_)com
work: Michael(_dot_)Kay(_at_)softwareag(_dot_)com
-----Original Message-----
From: owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
[mailto:owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com] On Behalf Of
Lopez, William
Sent: 07 January 2003 23:14
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] Best practice for "walking" node
Sorry if this is trivial...I was wondering which way is best
to access elements/attributes. I was playing around with the
axis (pardon if the lingo is bogus) way of accessing
elements/attributes and found the following ways work but is
there an advantage of using one over the other (besides
brevity of code). See 1. & 2. below.
<xsl:value-of
select="./following-sibling::WorkGroupCollection/WorkGroup/@name"/>
<xsl:value-of select="./following::WorkGroup/@name"/> <-- I
like this one because it is shorter
*** xml document ***
<WorkGroupMaint>
<BusinessUnitRef oid="0:0:0:1" name="BU01"> <-- 1.
processor is here
<TeamRef oid="0:0:1:1" name="TM01"/>
</BusinessUnitRef>
<WorkGroupCollection nbrWorkGroup="1">
<WorkGroup oid="0:0:0:2" name="WorkGroup 1"> <-- 2. I need @name
<WorkTypeCollection nbrWorkType="2">
...
</WorkGroupMaint>
*** xsl template ***
<xsl:template match="BusinessUnitRef">
<p id="topLabel">
<span class="info">Team: <xsl:value-of
select="TeamRef/@name"/></span><br/>
<span class="info">Business Unit: <xsl:value-of
select="@name"/></span><br/>
<xsl:choose>
<xsl:when test="$entryMode = 'Add'">
<span class="info">Work Group Name: </span>
<input type="text" name="txtWorkGroupName"
class="info" value="" size="30"/>
</xsl:when>
<xsl:otherwise>
<span class="info">Work Group Name:
<xsl:value-of select="./following::WorkGroup/@name"/></span>
</xsl:otherwise>
</xsl:choose>
</p>
</xsl:template>
Thanks,
-Will
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list