The XQuery channel is a bit lenient on how you write <>& tags. In the
xml source you'll have to escape them as <>&. Would be nice
if any text copied from the XQuery channel source window was
xml-escaped. Or that XQuery channel enforced stricter source conformity
rules.
<scripts>
<script language="XQuery">
define function makeMyTags($url, $title)
{
let $log := msg("----- makeMyTags -----")
let $xml :=
<font size = {3} face = {"Monaco"}>
<a href = { $url }>
{ $title } </a>
</font>
return source($xml)
}
</script>
</scripts>
<trigger path="URL.complete" language="JavaScript"
inputs="url=URL">
debug("----- URL.complete -----");
debug(url)
</trigger>
<trigger path="Internet.didInstall" language="JavaScript">
debug("----- Internet.didInstall -----");
DataStore.Set("Internet.DetailHTMLView.htmlData",
makeMyTags("sherlock://
com.MyCompany.Search?go_to_url=GoToURL&param=Param",
"Another sherlock: routing test"));
debug(XMLQuery.source(DataStore.Get("Internet.DetailHTMLView.htmlData"))
);
</trigger>
Jussi-Pekka
On Friday, December 6, 2002, at 10:13 AM, Ravi Pandya wrote:
> I tried this and ran into a problem. The sample code you gave runs
> fine if I paste it into the XQuery test channel. However, if I paste
> the exact same code into a trigger in my Channel.xml file, it does not
> run. There are no error messages, and no logging events are generated.
> I know the trigger is being run, because it runs if I replace the
> sample code with a trivial
> let $name := "Joe Smith"
> return $name
> Any idea what is going on here? I'm guessing it has to do the
> Channel.xml file being parsed as XML before it is handed to the XQuery
> processor. Thanks,
>
> Ravi
>
> On Thursday, December 5, 2002, at 03:47 PM, Riley Howard wrote:
>
>> From another engineer on the team:
>>
>>
>> We support some XML construct operation in XQuery.
>> All Element text and attribute values must be an enclosed expression
>> (inside curly braces '{' & '}' ).
>> XML is being generated so all element smust have an end tag.
>> An XML tree is being generated to get the tree as a string, Sherlock
>> supports
>> a "source" function that returns a XML tree as a string.
>> Here is are two simple examples that can be run in the XQuery channel:
>>
>> let $url := "http://www.apple.com"
>> let $title := "apple computer"
>> let $xml :=
>> <font size = {3} face = {"Monaco"}>
>> <a href = { $url }>
>> { $title } </a>
>> </font>
>> return source($xml)
>>
>>
>>
>> let $seq := ("a", "b", "c", "d", "e", "f", "g")
>> let $xml :=
>> <table>
>> {
>> for $item in to (1, count($seq)) return
>> <tr>
>> <td> { concat("Value ", $item) } </td>
>> <td> { item-at($seq, $item) } </td>
>> </tr>
>> }
>> </table>
>> return $xml/source(.)
_______________________________________________
sherlock-channel-development mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/sherlock-channel-development
Do not post admin requests to the list. They will be ignored.