Re: [xsl] accessing xml using node name

Subject: Re: [xsl] accessing xml using node name
From: David Carlisle <davidc@xxxxxxxxx>
Date: Wed, 17 May 2006 17:51:59 +0100
   <xsl:value-of  select="self::node()/node()[number($columnRow)]"

That could be written more simply as

   <xsl:value-of  select="*[number($columnRow)]"

there's no need to start a path with self::node() as relative paths
always are taken relative to the current node (ie, self::node())

* isn't equivalent to node() in teh next step but I suspect that you
intend * (ie counting element position) if you use node() then the
osition will be affecteded by any indentation or comments in your
 source file.

        <xsl:with-param name="id"><xsl:value-of 

You have several instances of this, it's generally a bad idea to use
param with-param or variable with content like this unless you really
need it. the above makes $id into a result tree fragment corresponding
to a root node with achild text node the string value of the old value
of $id. This is relatively expensive to construct and less useful as 4id
is no longer a node set so you can not use it in XPath steps.

        <xsl:with-param name="id" select="$id"/>

is simpler to type and makes $id have the same value as the old value of
$id so it's much more efficient and generally more useful.

           <xsl:value-of select="self::node()/node()[number($list)]"/>

typically your list is a comma separated list of values so number($list)
will be NaN and tge XPath will not select anything. You need to check if
it contains a , and if so just take the first number with
substring-before before using number().


This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:

Current Thread