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

global xsl:variable problem, value not being set

Subject: global xsl:variable problem, value not being set
From: ashok _ <listmanster@xxxxxxxxx>
Date: Mon, 7 Sep 2009 13:04:41 +0300
 global xsl:variable problem
I am not sure what i am doing wrong ... but i am setting a global
xsl:variable which I then refer to within the template but in the
output transform the variable is always blank,

My Xslt [1] , and the Xml being transformed [2].  The original xml
file is quite big, but i have trimmed it down to demonstrate the
problem. I guess I am missing something simple :-(

(Using saxon 9)

[1] -- Xslt -- refName is always set to blank

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
      <xsl:output indent="yes" method="xml" encoding="UTF-8"/>

  <xsl:variable name="refName">
      <xsl:value-of select="//meta[@id='judgementNo']/@href" />
  </xsl:variable>

      <xsl:template match="/">
              <xsl:apply-templates/>
      </xsl:template>


      <xsl:template match="*">
              <xsl:element name="{node-name(.)}">
                      <xsl:for-each select="@*">
                              <xsl:attribute name="{name(.)}">
                                      <xsl:value-of select="."/>
                              </xsl:attribute>
                      </xsl:for-each>
                      <xsl:apply-templates/>
              </xsl:element>
      </xsl:template>


      <xsl:template match="*[@name='ref']">
                      <metavalue>
                              <xsl:attribute
name="test"><xsl:value-of select="$refName"
/></xsl:attribute>
                      </metavalue>
              </xsl:template>
</xsl:stylesheet>


[2] Xml file being transformed :

<?xml version="1.0" encoding="UTF-8"?><root
xmlns="http://www.metalex.org/1.0" name="root" id="d3e1">
 <container id="judgement" class="Sect1" name="body">
    <mcontainer name="meta">
       <mcontainer id="references_d3e151" name="references"
source="#bungeni">
          <meta name="TLCConcept" id="judgementNo"
href="/ontology/concept/judgement/Judgement/653/07" showAs="653/07"/>
       </mcontainer>
    </mcontainer>
    <hcontainer __BungeniMetaEditable="false" id="header"
class="Sect2" name="Header">
       <htitle id="d3e7" name="heading" class="5f">THE SUPREME COURT
OF APPEAL REPUBLIC OF XXXXXX</htitle>
       <container id="d5e10" name="fixing_hcontainer">
          <block name="p" id="d3e10" class="Standard">Judgement No
:<inline name="ref" class="mJudgementNo" href="839" id="d5e12">14 of
2007</inline>
          </block>
       </container>
       <container id="d5e16" name="fixing_hcontainer">
          <block name="p" id="d3e19" class="P3">Case number:<inline
name="ref" class="mCaseNo" href="5166" id="d5e18">653/07</inline>
          </block>
       </container>
    </hcontainer>
 </container>
</root>

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.