This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Paramter passing in Xalan


I am experiencing a problem with parameter passing in Xalan.

I have an N-en.xml file containing a structure in English, and another
file with translations of parts of en.xml in latin - N-la.xml.  The
structure of N-en.xml is complex, but N-la.xml is simple, e.g.,

<latin>
    <text en="Ps90-15">
      Invocábit me, et ego exáudiam eum; erípiam eum, et glorificábo
      eum; longitúdine diérum adimplébo eum.
    </text>
    <text en="Ps90-1">
      Qui hábitat in adjutório Altíssimi in protectióne Dei c&oelig;li
      commorábitur.
    </text>
</latin>

Elements in N-en.xml which may have translations have an `id' attribute
of type ID.  The contents of this attribute are not constrained, except
by the type.  In N-la.xml, each translated element is a `text' element
with an `en' attribute whose contents match the contents of the `id'
attribute in N-en.xml.  E.g.

...
  <proper>
    <ofseason massname="First-Sunday-of-Lent" station="St. John
	      Lateran" class="First" sunday="true" colour="Violet">
      <introit id="Invocábit-me">
	<firstverse>
	  <psalmref psalmnum="90" verselist="15-16"/>
	  <versestext id="Ps90-15">
	    He shall call upon Me, and I will hear him; I will deliver
	    him, and glorify him; I will fill him with length of days.
	  </versestext>
	</firstverse>
  etc.

Here the `versestext' element has an id whose contents `Ps90-15' match
one of the `en' tags in N-la.xml.

My problems is to present both the English and the Latin text of these
elements.  I am attempting to access N-la.xml using document() in the
following way.

To access the Latin text, I have this (note the debugging output).  I
have a parameter, with a default value of `default'.

  <xsl:template match="latin/text">
    <xsl:param name="iden" select="'default'"/>
	Found latin/text
	  Where am I?
    <xsl:value-of select="name()"/>:
    <xsl:value-of select="@en"/>:
    <xsl:value-of select="$iden"/>:
    <xsl:value-of select="text[@en=$iden]"/>
  </xsl:template>

I am attempting to access this template using:
		Where am I?
		<xsl:value-of select="name()"/>
		id is:
		<xsl:value-of select="firstverse/versestext/@id"/>
		<xsl:variable name="fvid"
		    select="string(firstverse/versestext/@id)"/>
		Just set fvid
		<xsl:value-of select="$fvid"/>
		<xsl:apply-templates select="document($massfile-la)">
		  <xsl:with-param name="iden" select="$fvid"/>
		</xsl:apply-templates>

My output looks like:

                Where am I?
                introit
                id is:
                Ps90-15
                Just set fvid
                Ps90-15
    
        Found latin/text
          Where am I?
    text:
    Ps90-15:
    default:
    
    
        Found latin/text
          Where am I?
    text:
    Ps90-1:
    default:
    
My parameter is not being set - it stays as `default', even though the
required value `Ps90-15' is being set in the variable $fvid.  What am I
missing here?

Peter
-- 
 __ /__   Peter B. West  pbwest@netscape.net
   /     http://www.powerup.com.au/~pbwest
  /     "Lord, to whom shall we go?"


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]