Re: [xsl] XPTY0004: A sequence of more than one item is not allowed as the second argument of concat()

Subject: Re: [xsl] XPTY0004: A sequence of more than one item is not allowed as the second argument of concat()
From: Jack Bush <netbeansfan@xxxxxxxxxxxx>
Date: Mon, 9 Aug 2010 18:38:39 -0700 (PDT)
Hi Michael & Andrew,

Works perfectly this time.

Thanks again,

Jack

-----
Original Message ----
From: Michael Kay <mike@xxxxxxxxxxxx>
To:
xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Sent: Tue, 10 August, 2010 12:23:12 AM
Subject: Re: [xsl] XPTY0004: A sequence of more than one item is not allowed
as 
the second argument of concat()

Change
concat(./normalize-space(),./following-sibling::text()[normalize-space()])

to
concat(./normalize-space(),./following-sibling::text()[normalize-space()][1])
So you only select the first following sibling.

Michael Kay
Saxonica



On
09/08/2010 15:04, Jack Bush wrote:
> Hi All,
> I am getting the following
error message when trying to transform a 
>worldcup.xml
> using worldcup.xsl
stylesheet:
>
>B  Error on line 166
>B  B  XPTY0004: A sequence of more than
one item is not allowed as the second
> argument of concat()
>B  B  at
xsl:for-each (#165) processing /html/body[1]/div[2]/p[11]/a[1]
>B  B  at
xsl:apply-templates (#84) processing /html/body[1]/div[2]/p[11]
>B  B  at
xsl:apply-templates (#20) processing /html/body[1]/div[2]
>B  B  at
xsl:for-each (#19) processing
> /html/body[1]/div[2]/table[1]/tr[1]/td[1]/a[1]
> SEVERE: null
> ; SystemID: ; Line#: 166; Column#: -1
>
net.sf.saxon.trans.XPathException: A sequence of more than one item is not
>
allowed as the second argument of concat()
>
> Below is the worldcup.xsl:
>
>
> <xsl:template match="/">
>B  B  <worldcup>
>B  B  B  <xsl:apply-templates
>
select="document(concat(Spain.xml)/ns:html/ns:body/ns:div[@id='content']">
>B 
B  B  </xsl:apply-templates>
>B  B  </worldcup>
> </xsl:template>
>
<xsl:template match="/ns:html/ns:body/ns:div[@id='content']">
>B  B  B 
<xsl:variable name="worldcup-team" select="//ns:p[ns:strong='World Cup
>
Team:']"/>
>B  B  B  <xsl:apply-templates select="$ worldcup-team"/>
>B  B  B 
<xsl:if test="empty($worldcup-team)">
>B  B  B  B  <team>Unknown</team>
>B  B 
B  </xsl:if>
> <xsl:template match="ns:p[ns:strong=''World Cup Team:']">
>B 
B  <xsl:for-each select="ns:a">
>B  B  B  B  <team><xsl:value-of
>select="concat(./normalize-space(),./following-sibling::text()[normalize-spa
ce()])"/></team>
>>
>
>B  B  </xsl:for-each>
> </xsl:template>
> <xsl:template
match="ns:p"/>
> </xsl:stylesheet>
>B  
> The snippet of worldcup.xml are as
follows:
>
> <html xmlns="http://www.w3.org/1999/xhtml"; 
>
xmlns:html="http://www.w3.org/1999/xhtml";>
> <head>
>B  B  b&b&
> </head>
>
<body onload="loadMapLocation(-46.1240, 149.543, 49, 1); setClockTime(2008,
01,
> 19, 12, 36, 01); setInterval('updateTime()', 2000);"B 
onunload="GUnload();">
> <a shape="rect"B  name="top" />
> <div id="content">
> <hr/>
> <h1>World Cup Competition</h1>
> <p>
> </p>
> <p>
> <strong>World
Cup Team:</strong>
> <br clear="none" />
> <a shape="rect"B 
href="http://www.abc.com/team/spain.html?aid=427231";>Spain</a>
>
>B  (30
goals)
> <br clear="none" />
> <a shape="rect"B  href="
www.abc.com/team/denmark.html?aid=427231">Denmark</a>
>B  (25 goals)
> <br
clear="none" />
> <a shape="rect"B  href="
www.abc.com/team/Germany.html?aid=427231">Germany</a>
>B  (22 goals)
> <br
clear="none" />
> <a shape="rect"B  href="
www.abc.com/team/england.html?aid=427231">United
> Kingdom</a>
>B  (15 goals)
> <br clear="none" />
> b&b&
> </p>
> <p>
> </p>
> </div>
> </body>
>B  
>B 
> The desire output would be:
>
>B  <team>Spain(30 goals)<team>
>B 
<team>Denmark(25 goals)<team>
>B  <team>Germany(22 goals)<team>
>B 
<team>United Kingdom (15 goals)<team>
>
>
> Worldcup.xsl has been successful
in transforming worldcup.xml, if it was 
loaded
> as a main document in the
past.
>
> I am using JDOM and Saxon 9.1 to carry out the transformation on
Windows XP.
>B  
> Thanks in advance,
>
> Jack
>
>
>
>
>
>
--~------------------------------------------------------------------
>
XSL-List info and archive:B  http://www.mulberrytech.com/xsl/xsl-list
> To
unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
> or
e-mail:<mailto:xsl-list-unsubscribe@xxxxxxxxxxxxxxxxxxxxxx>
> --~--
>
>
>B  B 

Current Thread