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

Paramter passing in Xalan

Subject: Paramter passing in Xalan
From: "Peter B. West" <pbwest@xxxxxxxxxxxx>
Date: Sat, 17 Jun 2000 23:28:25 +1000
fvid
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@xxxxxxxxxxxx
   /     http://www.powerup.com.au/~pbwest
  /     "Lord, to whom shall we go?"


 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.