?
Solved

XPTY0004: A sequence of more than one item is not allowed as the first argument of string-length()

Posted on 2007-10-16
6
Medium Priority
?
3,835 Views
Last Modified: 2013-11-18
Hello Expert,

I am getting an error for the xsl code..

<xsl:if test="string-length($destination) &gt; 0"> where destination contains like...("mx.events.AIREvent.APPLICATION...", "mx.events.AIREvent.APPLICATION...", ...)

While processing it gives an error...

XPTY0004: A sequence of more than one item is not allowed as the first argument of string-length().

can you pls suggest the alternative for the line of code?

Thanks,
Shailesh
0
Comment
Question by:ShaileshShinde
  • 3
  • 3
6 Comments
 
LVL 1

Author Comment

by:ShaileshShinde
ID: 20084238
Hello Expert,

There is one more query with the same xslt...

the code is like...

<xsl:variable name="product" select="./@product|./@class | ./@outputclass"/>
            <xsl:if test="string-length($product)=0 or not($product=concat($hiddenProductName,'only'))">
                  <xsl:value-of disable-output-escaping="yes" select="'&lt;b&gt;'"/>
                  <xsl:call-template name="processTags"/>
                  <xsl:value-of disable-output-escaping="yes" select="'&lt;/b&gt;'"/>
            </xsl:if>

The error is appearing for <xsl:variable name="product" select="./@product|./@class | ./@outputclass"/>
as it contains more than one sequence...

Can you pls suggest the what change will required for the same?

Thanks,
Shailesh
0
 
LVL 60

Expert Comment

by:Geert Bormans
ID: 20085525
always the same problem,
If you have a selection of nodes, there is no automatic concatenation,
and a string-length requires one single string-type (XPath2 is very tricky about types)
If you want a concatenation, you should use string-join
<xsl:variable name="product" select="string-join((./@product|./@class | ./@outputclass), '')"/>

I don't like the disable-output-encoding here
                  <xsl:value-of disable-output-escaping="yes" select="'&lt;b&gt;'"/>
                  <xsl:call-template name="processTags"/>
                  <xsl:value-of disable-output-escaping="yes" select="'&lt;/b&gt;'"/>

why don't you do this?
                  <b>
                      <xsl:call-template name="processTags"/>
                  </b>


your first example could be done the same way,

cheers

Geert
0
 
LVL 1

Author Comment

by:ShaileshShinde
ID: 20092867
Hello expert,

Is this applicable for ...<xsl:variable name="firstPassToken" select="substring-before($dest,concat('.',$lastToken))"/>

Thanks,
Shailesh
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 60

Accepted Solution

by:
Geert Bormans earned 375 total points
ID: 20093034
yes
I assume that '.' refers to a text node already
so you could do
...<xsl:variable name="firstPassToken" select="substring-before(string-join($dest ,concat('.',$lastToken), ''))"/>
0
 
LVL 1

Author Comment

by:ShaileshShinde
ID: 20121888
Hello expert,

<xsl:variable name="firstPassToken" select="substring-before(string-join($dest ,concat('.',$lastToken), ''))"/> gives an error saying string-join() must have two arguments.

Thanks,
Shailesh
0
 
LVL 60

Expert Comment

by:Geert Bormans
ID: 20121897
this seems more like it
<xsl:variable name="firstPassToken" select="substring-before(string-join($dest , ''),concat('.',$lastToken))"/>
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most of the sites are being standardized with W3C Web Standards. W3C provides lot of web standard services to the web. They have the web specification, process and documentation for all the web standards. You can apply HTML, CSS and Accessibility st…
I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question