Subject: [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 07:04:55 -0700 (PDT) |
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 XPTY0004: A sequence of more than one item is not allowed as the second argument of concat() B at xsl:for-each (#165) processing /html/body[1]/div[2]/p[11]/a[1] B at xsl:apply-templates (#84) processing /html/body[1]/div[2]/p[11] B at xsl:apply-templates (#20) processing /html/body[1]/div[2] 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 <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 </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 B <team>Unknown</team> B B B </xsl:if> <xsl:template match="ns:p[ns:strong=''World Cup Team:']"> B <xsl:for-each select="ns:a"> B B B B B <team><xsl:value-of select="concat(./normalize-space(),./following-sibling::text()[normalize-spac e()])"/></team> 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"B xmlns:html="http://www.w3.org/1999/xhtml" > <head> 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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] document () return values, Dave Pawson | Thread | Re: [xsl] XPTY0004: A sequence of m, Andrew Welch |
Re: [xsl] XPath behaves differently, Jack Bush | Date | Re: [xsl] XPTY0004: A sequence of m, Andrew Welch |
Month |