Print

Print


What Joyce said.  

There's nothing technically invalid with the XSLT markup in 1.0 or 2.0, but if you feed that particular template any XML documents that have more than one node with values that it can convert into strings for any of those conditionals present, then the transformation will fail.  Alternatively, you can just test for the nodes themselves w/o failure by removing the "string" functions.  My guess is that you might've been using "string" in this way to try and rule out empty nodes?  If that's the case, there are other ways to do that.

Finally, we are not using 2.0 in our production version yet, but I'm not exactly clear on what the barriers would be since we would only be serving up HTML/CSS/JavaScript to the browser.  So far, though, I've just used it to transform XML -> XML.

Mark

-----Original Message-----
From: Encoded Archival Description List [mailto:[log in to unmask]] On Behalf Of Joyce Chapman
Sent: Friday, June 03, 2011 10:00 AM
To: [log in to unmask]
Subject: Re: XSLT 1.0 => 2.0

Hi Michelle,

As for the cause of that error message, it happens when what you are feeding as input doesn't match what something is able to accept as input. So string() doesn't take a set of nodes and then return true if any of them meet the criteria, it takes a single input and returns true if it meets the criteria. As the error message says, more than one item is not allowed as the first argument of string(). When you get that error it means you have multiple items inputting as values of the first argument and you need to refine what you're feeding in (refine the xpath inside the parens for the first argument so that it only refers to one node).

Joyce


On Fri, Jun 3, 2011 at 9:12 AM, Michele R Combs <[log in to unmask]> wrote:
>
> Just for fun, I took a quick run at converting our style sheets from XSLT1.0 to XSLT2.0 this week and got the following error:
>
> Error on line 451 of eadcbs6-su1.xsl:
> �XPTY0004: A sequence of more than one item is not allowed as the 
> first argument of
> �string() (<head/>, <p/>)
> �at xsl:call-template name="toc" 
> (file:/G:/LIB/Special%20Collections/Digital%20Projects/EAD/saxon/../st
> yles/eadcbs6-su1.xsl#230)
> �in built-in template rule
> Transformation failed: Run-time errors were reported
>
> Line 451, in context, looks like this:
>
> � � �<xsl:if test="string(archdesc/acqinfo/*)
> � � �or string(archdesc/processinfo/*)
> � � �or string(archdesc/prefercite/*)
> � � �or string(archdesc/custodialhist/*)
> � � �or string(archdesc/processinfo/*)
> � � �or string(archdesc/appraisal/*)
> � � �or string(archdesc/accruals/*)
> � � �or string(archdesc/*/acqinfo/*)
> � � �or string(archdesc/*/processinfo/*)
> � � �or string(archdesc/*/prefercite/*)
> � � �or string(archdesc/*/custodialhist/*)
> � � �or string(archdesc/*/processinfo/*)
> � � �or string(archdesc/*/appraisal/*)
> � � �or string(archdesc/*/accruals/*)"> � � <= line 451
> � � � � <p class="toclink">
> � � � � � �<a class="toc" href="#adminlink">
> � � � � � � � <xsl:text>Administrative Information</xsl:text>
> � � � � � �</a>
> � � � � </p>
> � � �</xsl:if>
>
> I've checked the W3C document at http://www.w3.org/TR/xslt20/#incompatibilities (which, while not impenetrable, is not exactly crystal clear either) and am not sure what the problem is. �Surely I can test multiple conditions, so is it a syntax thing?
>
> Michele
>
> ++++++++++++++++
> Michele Combs
> Librarian for Manuscripts and Archives Processing Special Collections 
> Research Center Syracuse University
> 315-443-2081
> [log in to unmask]



--
Joyce Chapman
NCSU Libraries
Metadata and Cataloging/
Digital Library Initiatives
[log in to unmask]