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

Re: variable question

Subject: Re: variable question
From: Bruce D'Arcus <bdarcus@xxxxxxxxxxxxx>
Date: Tue, 31 Aug 2004 07:15:01 -0400
xsl function parent
On Aug 31, 2004, at 6:03 AM, David Carlisle wrote:

However teh system doesn't agree with you, there's no point in asking
us
to guess, just find out what it is:

It reported a number of these messages: parent is [[mods]]


The output was incorrect, though, so I modified the function like so:

<xsl:function name="mods:reftype" as="xs:string">
  <xsl:param name="bibref" as="element(mods:mods)" />
  <xsl:choose>
    <xsl:when test="$bibref/mods:relatedItem/@type = 'host'">
      <xsl:variable name="issuance"

select="$bibref/mods:relatedItem//mods:originInfo/mods:issuance" />
      <xsl:choose>
        <xsl:when test="$issuance = 'continuing'">article</xsl:when>
        <xsl:when test="$issuance = 'monographic'">chapter</xsl:when>
      </xsl:choose>
    </xsl:when>
    <xsl:otherwise>book</xsl:otherwise>
  </xsl:choose>
</xsl:function>

Now, if I use this template, it runs through and I get the correct
output:

<xsl:template match="mods:titleInfo" mode="title-before">
  <xsl:choose>
  <xsl:when test="not(parent::mods:mods)">
<xsl:message>
parent is [[<xsl:value-of select="name(..)"/>]]
</xsl:message>
  </xsl:when>
  <xsl:otherwise>
  <xsl:if test="mods:reftype(parent::mods:mods) = 'chapter'">
    <xsl:text></xsl:text>
  </xsl:if>
  </xsl:otherwise>
  </xsl:choose>
</xsl:template>

However, if I use this instead:

<xsl:template match="mods:titleInfo" mode="title-before">
  <xsl:if test="mods:reftype(parent::mods:mods) = 'chapter'">
    <xsl:text></xsl:text>
  </xsl:if>
</xsl:template>

.... I get this error:

 An empty sequence is not allowed as the first argument of
mods:reftype()
Transformation failed: Run-time errors were reported

???

Bruce

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.