xsl-list
[Top] [All Lists]

Re: [xsl] Param value not getting value passed

2011-01-30 17:16:19
OK, I reworked both selects and default parameters as suggested.  I
have stepped through the code (again) and this time realizing that the
context when I apply templates is not what I was expecting.  The
context is:

Booklet/TimeTable, and the actual match is
"Booklet/TimeTable/Times/DayGroups/DayGroup/Times

So without an explicit select that matches my match, you are saying
the engine is taking some intermediate steps along the way and the
parameter value then gets lost (in 1.0).

How does the engine get from the context to the match anyhow?
Shouldn't it fail, not match anything?  Given,

<a>
<b><c/><c/><b>
</a>

If the context is <a>, and the apply-templates is select="." and the
only template match is <c>, this match works?  Hmm, didn't think that
worked.  Testing this now.

Karl..


On Sun, Jan 30, 2011 at 3:14 PM, G. Ken Holman
<gkholman(_at_)cranesoftwrights(_dot_)com> wrote:

My guess is that your stylesheet is going through the built-in template 
rules, which do not pass simply-passed parameter values down.  What you have 
coded only works if the template being invoked is invoked without the 
built-in template rules having been invoked in-between.

Note, however, that XSLT 2 supports tunnel parameters, which can be 
considered to be automatically passed through every <xsl:apply-templates> and 
every <xsl:call-template>, including built-in template rules, without having 
to say so explicitly.

So, if you are running XSLT 2, try:

  <xsl:with-param  name="group-value" tunnel="yes" select="16"/>

... and the corresponding:

  <xsl:param name="group-value" tunnel="yes" select="0"/>

BTW, you should note that:

 select="number(16)"

... is redundant because just "16" is also interpreted as a number, and that

 <xsl:param name="group-value">0</xsl:param>

... creates a variable of the type document tree with a root node and a text 
node with the character 0, whereas my use of the select attribute has the 
data type of number, which is what I think you are trying to use.

I hope this helps.

. . . . . . Ken

At 2011-01-30 15:05 -0700, Karl Stubsjoen wrote:

I'm perplexed.  I have a template match routine and param value that
is not receiving the param value passed.  I am passing the param value
like this:

<xsl:with-param name="group-value" select="number(16)"/>

The param is defined in the template match like this:
<xsl:param name="group-value">0</xsl:param>

The value is always:
type:ABC
value: "0"
(According to Oxygen)

I have a simple XML sample and the number param value is passed fine.
In my real example (working xml/xsl templates) it is not passed.  The
stylsheet is quite involved (over 30,000 lines).  I am stepping
through the code (I can provide screen shots) and the param value
default to the >0< "0" value.  Any ideas?  I have stepped through this
a 1/2 dozen times now!

Karl..

--
Karl Stubsjoen
MeetScoresOnline.com
(602) 845-0006


--
Contact us for world-wide XML consulting & instructor-led training
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/s/
G. Ken Holman                 mailto:gkholman(_at_)CraneSoftwrights(_dot_)com
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--




--
Karl Stubsjoen
MeetScoresOnline.com
(602) 845-0006

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>