954,568 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

only one item as 1st arg of matches() error

I'm working on scraping HTML pages and transforming the selected content from them into XML and I've been seeing a few errors here and there thrown by the Saxon XSLT parser:

WARN [2011-01-07 14:44:35 EST] (SaxonTranslator#429473) improper java log: XPTY0004: A sequence of more than one item is not allowed as the first argument of
WARN [2011-01-07 14:44:35 EST] (SaxonTranslator#429473) improper java log: matches() ("

weloki
Newbie Poster
4 posts since Nov 2010
Reputation Points: 10
Solved Threads: 0
 

The error is pretty self explanatory. The matches functions takes a single supplied STRING and tests if it matches a certain regex format. anytime you call the matches() functions you can only put a single string in the input. "matches(//body, $date_regex)" it's VERY unlikely that there's 1 string in the body node of an entire document. You'll have to drill down specifically to 1 and only 1 string before you use the matches() function.

iceandrews
Junior Poster
185 posts since May 2010
Reputation Points: 10
Solved Threads: 30
 


...
...

...

weloki
Newbie Poster
4 posts since Nov 2010
Reputation Points: 10
Solved Threads: 0
 

Yep, a predicate of [1] will get you the first "body" element that returns. That would solve the problem :) Glad you figured it out.

iceandrews
Junior Poster
185 posts since May 2010
Reputation Points: 10
Solved Threads: 30
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You