From Stacy.Ladnier at noaa.gov Wed Jul 8 12:08:13 2009 From: Stacy.Ladnier at noaa.gov (Stacy.Ladnier@noaa.gov) Date: Wed Jul 8 03:10:33 2009 Subject: [xquery-talk] Better way to structure XQuery Message-ID: I have the following XQuery: xquery version="1.0"; let $mydoc :=doc('http://localhost:8080/exist/rest/db/bio.xml') let $profileType := 'Standard' let $profileType := if ($mydoc/metadata/idinfo/spdom/bounding/boundalt/altmin or $mydoc/metadata/idinfo/spdom/bounding/boundalt/altmax) then 'Biological' else $profileType return {$profileType> This works fine, however, I would like to take the paths and place them in a sequence (there are potentially 30+ I need to check for). I am new to XQuery/XPath and unable to figure out the proper way to do this. Can anyone let me know how to use two variables, one being the $mydoc and one being a string ($path := '/metadata/idinfo/spdom/bounding/boundalt/altmin') and have it evaluate as XPath instead of as a string? From gkholman at CraneSoftwrights.com Wed Jul 8 13:32:27 2009 From: gkholman at CraneSoftwrights.com (G. Ken Holman) Date: Wed Jul 8 03:25:12 2009 Subject: [xquery-talk] Better way to structure XQuery In-Reply-To: References: Message-ID: <7.0.1.0.2.20090708121623.0265ae40@wheresmymailserver.com> At 2009-07-08 11:08 -0500, Stacy.Ladnier@noaa.gov wrote: >I have the following XQuery: > >xquery version="1.0"; > >let $mydoc :=doc('http://localhost:8080/exist/rest/db/bio.xml') >let $profileType := 'Standard' >let $profileType := if >($mydoc/metadata/idinfo/spdom/bounding/boundalt/altmin or >$mydoc/metadata/idinfo/spdom/bounding/boundalt/altmax) then 'Biological' >else $profileType > >return > > {$profileType> > As an aside, I would have written that as: xquery version="1.0"; { if ( doc('http://localhost:8080/exist/rest/db/bio.xml')/ metadata/idinfo/spdom/bounding/boundalt/altmin or doc('http://localhost:8080/exist/rest/db/bio.xml')/ metadata/idinfo/spdom/bounding/boundalt/altax ) then 'Biological" else 'Standard' } ... because I would assume that the processor would have cached the document in memory during the transformation rather than accessing the resource each time. I'm unsure why you would have used and re-used the $profileType variable. >This works fine, however, I would like to take the paths and place them >in a sequence (there are potentially 30+ I need to check for). I am new >to XQuery/XPath and unable to figure out the proper way to do this. > >Can anyone let me know how to use two variables, one being the $mydoc >and one being a string ($path := >'/metadata/idinfo/spdom/bounding/boundalt/altmin') and have it evaluate >as XPath instead of as a string? There is no equivalent to eval() available to you. However, if you have a text serialization available in your XQuery implementation then XQuery is composable (XSLT moreso I find because it is all simple XML) so you can run two steps, the first to compose the necessary XQuery that is run in the second. I have an example below that uses Saxon. I have no idea what you want to do with your XPath expressions since you are asking about getting them one at a time, yet you are using two of them in your sample. I hope this helps give you an idea. . . . . . . . . . . . . . Ken p.s. I hope on Friday to announce a hands-on XQuery class in California this summer ... plans are in the works and there is a survey out to help determine interest in particular delivery dates T:\ftemp>type stacy.xml /metadata/idinfo/spdom/bounding/boundalt/altmin /metadata/idinfo/spdom/bounding/boundalt/altmax T:\ftemp>type stacy.xq declare namespace saxon = "http://saxon.sf.net/"; declare option saxon:output "method=text"; "let $mydoc := doc( 'bio.xml' ) return <result> ", for $each in xpaths/xpath return concat("<subresult> {if ($mydoc",$each,") then 'Biological' else 'Standard'} </subresult>"), "</result>" T:\ftemp>xquery stacy.xml stacy.xq generated.xq T:\ftemp>type generated.xq let $mydoc := doc( 'bio.xml' ) return {if ($mydoc/metadata/idinfo/spdom/bounding/boundalt/altmin) then 'B iological' else 'Standard'} {if ($mydoc/metadata/idinfo/spdom/bounding/boundalt/altmax) then 'B iological' else 'Standard'} T:\ftemp>xquery bio.xml generated.xq Source document ignored - query does not access the context item Standard Standard T:\ftemp> -- Possible July/August XSLT/XQuery/XSL-FO training in Oakland/CA/USA Crane Softwrights Ltd. http://www.CraneSoftwrights.com/q/ Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video Video lesson: http://www.youtube.com/watch?v=PrNjJCh7Ppg&fmt=18 Video overview: http://www.youtube.com/watch?v=VTiodiij6gE&fmt=18 G. Ken Holman mailto:gkholman@CraneSoftwrights.com Male Cancer Awareness Nov'07 http://www.CraneSoftwrights.com/q/bc Legal business disclaimers: http://www.CraneSoftwrights.com/legal From dlee at calldei.com Wed Jul 8 13:40:46 2009 From: dlee at calldei.com (David A. Lee) Date: Wed Jul 8 03:29:55 2009 Subject: [xquery-talk] Better way to structure XQuery In-Reply-To: <7.0.1.0.2.20090708121623.0265ae40@wheresmymailserver.com> References: <7.0.1.0.2.20090708121623.0265ae40@wheresmymailserver.com> Message-ID: <4A54CC0E.3040506@calldei.com> A scripting language like xproc or xmlsh can do this where xquery cannot directly. For example, in xmlsh xread doc < file.xml xpaths=(xpath1 xpath2 xpath3 xpath4) for $x in $xpaths ; do r=$<(xquery -q $x -i $doc) xecho <[ {$r} ]> done David A. Lee dlee@calldei.com http://www.calldei.com http://www.xmlsh.org 812-482-5224 G. Ken Holman wrote: > At 2009-07-08 11:08 -0500, Stacy.Ladnier@noaa.gov wrote: >> I have the following XQuery: >> >> xquery version="1.0"; >> >> let $mydoc :=doc('http://localhost:8080/exist/rest/db/bio.xml') >> let $profileType := 'Standard' >> let $profileType := if >> ($mydoc/metadata/idinfo/spdom/bounding/boundalt/altmin or >> $mydoc/metadata/idinfo/spdom/bounding/boundalt/altmax) then 'Biological' >> else $profileType >> >> return >> >> {$profileType> >> > > As an aside, I would have written that as: > > xquery version="1.0"; > > { if ( doc('http://localhost:8080/exist/rest/db/bio.xml')/ > metadata/idinfo/spdom/bounding/boundalt/altmin or > doc('http://localhost:8080/exist/rest/db/bio.xml')/ > metadata/idinfo/spdom/bounding/boundalt/altax ) > then 'Biological" else 'Standard' } > > > ... because I would assume that the processor would have cached the > document in memory during the transformation rather than accessing the > resource each time. I'm unsure why you would have used and re-used > the $profileType variable. > >> This works fine, however, I would like to take the paths and place them >> in a sequence (there are potentially 30+ I need to check for). I am new >> to XQuery/XPath and unable to figure out the proper way to do this. >> >> Can anyone let me know how to use two variables, one being the $mydoc >> and one being a string ($path := >> '/metadata/idinfo/spdom/bounding/boundalt/altmin') and have it evaluate >> as XPath instead of as a string? > > There is no equivalent to eval() available to you. > > However, if you have a text serialization available in your XQuery > implementation then XQuery is composable (XSLT moreso I find because > it is all simple XML) so you can run two steps, the first to compose > the necessary XQuery that is run in the second. > > I have an example below that uses Saxon. I have no idea what you want > to do with your XPath expressions since you are asking about getting > them one at a time, yet you are using two of them in your sample. > > I hope this helps give you an idea. > > . . . . . . . . . . . . . Ken > > p.s. I hope on Friday to announce a hands-on XQuery class in > California this summer ... plans are in the works and there is a > survey out to help determine interest in particular delivery dates > > T:\ftemp>type stacy.xml > > /metadata/idinfo/spdom/bounding/boundalt/altmin > /metadata/idinfo/spdom/bounding/boundalt/altmax > > > T:\ftemp>type stacy.xq > declare namespace saxon = "http://saxon.sf.net/"; > declare option saxon:output "method=text"; > > "let $mydoc := doc( 'bio.xml' ) > return <result> > ", > for $each in xpaths/xpath > return concat("<subresult> > {if ($mydoc",$each,") then 'Biological' else 'Standard'} > </subresult>"), > "</result>" > > T:\ftemp>xquery stacy.xml stacy.xq generated.xq > > T:\ftemp>type generated.xq > let $mydoc := doc( 'bio.xml' ) > return > > {if > ($mydoc/metadata/idinfo/spdom/bounding/boundalt/altmin) then 'B > iological' else 'Standard'} > > {if > ($mydoc/metadata/idinfo/spdom/bounding/boundalt/altmax) then 'B > iological' else 'Standard'} > > T:\ftemp>xquery bio.xml generated.xq > Source document ignored - query does not access the context item > > > Standard > Standard > > T:\ftemp> > > > > -- > Possible July/August XSLT/XQuery/XSL-FO training in Oakland/CA/USA > Crane Softwrights Ltd. http://www.CraneSoftwrights.com/q/ > Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video > Video lesson: http://www.youtube.com/watch?v=PrNjJCh7Ppg&fmt=18 > Video overview: http://www.youtube.com/watch?v=VTiodiij6gE&fmt=18 > G. Ken Holman mailto:gkholman@CraneSoftwrights.com > Male Cancer Awareness Nov'07 http://www.CraneSoftwrights.com/q/bc > Legal business disclaimers: http://www.CraneSoftwrights.com/legal > > _______________________________________________ > talk@x-query.com > http://x-query.com/mailman/listinfo/talk From adam.retter at googlemail.com Wed Jul 8 18:46:22 2009 From: adam.retter at googlemail.com (Adam Retter) Date: Wed Jul 8 03:32:28 2009 Subject: [xquery-talk] Better way to structure XQuery In-Reply-To: References: Message-ID: 2009/7/8 : > I have the following XQuery: > > xquery version="1.0"; > > let $mydoc :=doc('http://localhost:8080/exist/rest/db/bio.xml') > let $profileType := 'Standard' > let $profileType := if > ($mydoc/metadata/idinfo/spdom/bounding/boundalt/altmin or > $mydoc/metadata/idinfo/spdom/bounding/boundalt/altmax) then 'Biological' > else $profileType > > return > ? > ? ? ?{$profileType> > ? This could possibly be rewritten in a couple of different ways. These 30+ paths, is there some common element to them - are they all children of another node? are there other children at the same level? I am thinking that you may be able to express your query without evaluating 30 paths! > Can anyone let me know how to use two variables, one being the $mydoc > and one being a string ($path := > '/metadata/idinfo/spdom/bounding/boundalt/altmin') and have it evaluate > as XPath instead of as a string? You need an evaluate function. Unfortunately there is no evaluation function in the XQuery 1.0 specification. However, almost every XQuery implementation I have seen provides its own proprietary evaluation function. What XQuery implementation are you using? -- Adam Retter sip:adam.retter@ekiga.net http://www.adamretter.org.uk From mike at saxonica.com Wed Jul 8 18:46:13 2009 From: mike at saxonica.com (Michael Kay) Date: Wed Jul 8 03:32:33 2009 Subject: [xquery-talk] Better way to structure XQuery In-Reply-To: References: Message-ID: <1F5F6668281C41A5BB35A87BC847221A@Sealion> XQuery doesn't allow dynamic evaluation of an XPath expression held in a string. Some products have extensions to do this - but it's not at all clear that it's a good idea here (it would probably be expensive) - unless there's something about the requirement that you haven't explained. Regards, Michael Kay http://www.saxonica.com/ http://twitter.com/michaelhkay > -----Original Message----- > From: talk-bounces@x-query.com > [mailto:talk-bounces@x-query.com] On Behalf Of Stacy.Ladnier@noaa.gov > Sent: 08 July 2009 17:08 > To: talk@x-query.com > Subject: [xquery-talk] Better way to structure XQuery > > I have the following XQuery: > > xquery version="1.0"; > > let $mydoc :=doc('http://localhost:8080/exist/rest/db/bio.xml') > let $profileType := 'Standard' > let $profileType := if > ($mydoc/metadata/idinfo/spdom/bounding/boundalt/altmin or > $mydoc/metadata/idinfo/spdom/bounding/boundalt/altmax) then > 'Biological' > else $profileType > > return > > {$profileType> > > > This works fine, however, I would like to take the paths and > place them in a sequence (there are potentially 30+ I need to > check for). I am new to XQuery/XPath and unable to figure out > the proper way to do this. > > Can anyone let me know how to use two variables, one being > the $mydoc and one being a string ($path := > '/metadata/idinfo/spdom/bounding/boundalt/altmin') and have > it evaluate as XPath instead of as a string? > _______________________________________________ > talk@x-query.com > http://x-query.com/mailman/listinfo/talk From villard at us.ibm.com Wed Jul 8 13:58:02 2009 From: villard at us.ibm.com (Lionel Villard) Date: Wed Jul 8 03:37:15 2009 Subject: [xquery-talk] Better way to structure XQuery In-Reply-To: References: Message-ID: Skipped content of type multipart/alternative-------------- next part -------------- A non-text attachment was scrubbed... Name: graycol.gif Type: image/gif Size: 105 bytes Desc: not available Url : http://x-query.com/pipermail/talk/attachments/20090708/672ce18a/graycol.gif From Stacy.Ladnier at noaa.gov Wed Jul 8 13:41:13 2009 From: Stacy.Ladnier at noaa.gov (Stacy.Ladnier@noaa.gov) Date: Wed Jul 8 03:59:41 2009 Subject: [xquery-talk] Better way to structure XQuery Message-ID: I am trying to write a query used to detect what type of Profile a particular file is. I do this by detecting the presence of tags that are specific to that particular profile. The paths to check can be in multiple locations, not necessarily sharing the same parent (often the metadata element is the only thing in common with the paths) but, it is possible as shown in the two paths in the code, that some are siblings. Ideally, once the method detects a path exists, the code should change the profileType from its default of Standard to the new type of Biological. All other processing is considered insignificant and it would be nice to break out of the loop as soon as the change occurs. Unfortunately, I have had no luck getting that to work. The following code is what I have now, and it works. But something tells me it can be better. I am using XQuery implementation within the eXist database if that helps. let $mydoc :=doc('http://localhost:8080/exist/rest/db/bio.xml') let $profileType := 'Standard' let $paths := ($mydoc/metadata/idinfo/spdom/bounding/boundalt/altmin, $mydoc/metadata/idinfo/spdom/bounding/boundalt/altmax, path3, path4, ...) for $p in $paths let $profileType := if ($p) then 'Biological' else $profileType I would LOVE to use something similar to Ken's example, where I can store the paths in an xml file and pull them in, but I am not fond of using the two step process his example requires. Not saying it is wrong, just personal preference and ease of use within Orbeon/eXist framework. Thanks for all the responses! This is my first post and I am impressed at the level of assistance everyone is taking the time to give me. -------------- next part -------------- Skipped content of type multipart/related-------------- next part -------------- _______________________________________________ talk@x-query.com http://x-query.com/mailman/listinfo/talk From christian.gruen at gmail.com Wed Jul 8 21:04:08 2009 From: christian.gruen at gmail.com (=?ISO-8859-1?Q?Christian_Gr=FCn?=) Date: Wed Jul 8 04:13:51 2009 Subject: [xquery-talk] Better way to structure XQuery In-Reply-To: References: Message-ID: > The following code is what I have now, and it works. But something tells > me it can be better. I am using XQuery implementation within the eXist > database if that helps. > > let $mydoc :=doc('http://localhost:8080/exist/rest/db/bio.xml') > let $profileType := 'Standard' > let $paths := ($mydoc/metadata/idinfo/spdom/bounding/boundalt/altmin, > $mydoc/metadata/idinfo/spdom/bounding/boundalt/altmax, path3, path4, ...) > > for $p in $paths > ? let $profileType := if ($p) then 'Biological' else $profileType Stacy, I don't know if this helps, but you your query could be simplified as follows: let $mydoc := doc('http://localhost:8080/exist/rest/db/bio.xml') let $profileType := if( $mydoc/metadata/idinfo/spdom/bounding/boundalt/altmin, $mydoc/metadata/idinfo/spdom/bounding/boundalt/altmax, path3, path4, ... ) then 'Biological' else 'Standard' return ... If one of the paths exists, $profileType will be set to 'Biological'. - As variables cannot be assigned more than once in XQuery, a second assignment of $profileType will just hide the first one. Best, Christian, http://basex.org From wolfgang at exist-db.org Wed Jul 8 22:56:01 2009 From: wolfgang at exist-db.org (Wolfgang) Date: Wed Jul 8 12:30:58 2009 Subject: [xquery-talk] Better way to structure XQuery In-Reply-To: References: Message-ID: <4A54F9D1.3080602@exist-db.org> > I don't know if this helps, but you your query could be simplified as follows: > > let $mydoc := doc('http://localhost:8080/exist/rest/db/bio.xml') As another side note, using an http uri here is unnecessary and makes the query slow. eXist will assume that you are referencing an external document (ignoring the 'localhost') and will retrieve it into memory. Better use doc('/db/bio.xml') to have eXist access the document tree which is already stored in the db. Wolfgang From Stacy.Ladnier at noaa.gov Wed Jul 8 16:01:47 2009 From: Stacy.Ladnier at noaa.gov (Stacy.Ladnier@noaa.gov) Date: Wed Jul 8 12:32:44 2009 Subject: [xquery-talk] Better way to structure XQuery Message-ID: Absolutely. I have the full URI right now only because I was testing in an editor outside of exist. When put in, I will definitely use the more appropriate reference. ----- Original Message ----- From: Wolfgang Date: Wednesday, July 8, 2009 2:56 pm Subject: Re: [xquery-talk] Better way to structure XQuery > > I don't know if this helps, but you your query could be > simplified as follows: > > > > let $mydoc := doc('http://localhost:8080/exist/rest/db/bio.xml') > > As another side note, using an http uri here is unnecessary and > makes > the query slow. eXist will assume that you are referencing an > external > document (ignoring the 'localhost') and will retrieve it into > memory. > Better use doc('/db/bio.xml') to have eXist access the document > tree > which is already stored in the db. > > Wolfgang > From matthias.brantner at 28msec.com Thu Jul 9 13:41:48 2009 From: matthias.brantner at 28msec.com (Matthias Brantner) Date: Wed Jul 8 21:36:26 2009 Subject: [xquery-talk] [ANN] Release of XQuery Development Tools 2.0 Message-ID: <92306FDD-037E-4BCE-BE17-E8ACFEE512FE@28msec.com> Dear all, We are happy to announce XQDT 2.0. This is the first complete release of XQDT 2.0. XQDT 2.0 is based on the Dynamic Language Toolkit (DLTK) of Eclipse to provide a fully featured XQuery development environment. It requires Eclipse version 3.4 or higher. This XQDT release has the following functionality: * Support for XQuery 1.1 (e.g., try-catch, group by, windowing) * Support for XQuery Updates and Scripting (as defined in the public Standard / Working Draft) * Code completion and code templates * Debugger (with Sausalito and Zorba; support for other processor in preparation) * Semantic checking (with Sausalito and Zorba; support for other processor in preparation) You can install this release by either updating your previous XQDT 2.0 (pre-release) installation or by installing it by using our update site: http://www.xqdt.org/xqdt/2.0. For more details, please refer to our installation instructions (see http://www.xqdt.org/index.php/installing-xqdt-20/) and our getting started guide (see http://www.xqdt.org/index.php/getting-started-with-xqdt-20-and-zorba/) . Thanks for all your feedback so far. Please, continue to post bugs and feature requests on Sourceforge or by E-Mail to xqdt-users@lists.sourceforge.net. Your feedback helps us immensely. Best regards Matthias From gary.m.lewis at gmail.com Fri Jul 10 13:51:54 2009 From: gary.m.lewis at gmail.com (Gary Lewis) Date: Fri Jul 10 03:56:48 2009 Subject: [xquery-talk] dynamic xhtml with xquery Message-ID: <1be6002b0907100951m7510cc14jc7468e25182eb869@mail.gmail.com> I'm stuck on a problem that must occur frequently, yet lots of reading, google searches, and xquery experimentation have not yet provided a solution. I'm writing in hopes that someone can point me to an faq or similar info. Here's the situation. I'd like to use xquery to write dynamic xhtml (ie, to write xhtml on-the-fly that can be viewed in a browser without additional editing). I started with a small project involving rss, using zorba's xquery REST functionality and GET to access the rss (returned as xml). I then wrote an xquery to serialize the xml and return xhtml. No problems when displayed in a browser (Firefox) ... except for special characters. As you'd expect, the GET returns angle brackets as < and > and since the rss contains many href links there are many of these < and > substitutions. The browser renders them correctly as > and < but, naturally, the resulting href is seen as text and not as a link. I've tried lots of different possible solutions, all of which I realize now were silly although useful for learning what not to do. Any help would be much appreciated. Thanks. Gary Lewis From jim.melton at acm.org Fri Jul 10 11:42:39 2009 From: jim.melton at acm.org (Jim Melton) Date: Fri Jul 10 04:03:25 2009 Subject: [xquery-talk] [ANN] W3C XML Query WG and XSL WG Full Text Test Suite Message-ID: <7.0.1.0.2.20090710104217.0d5d6e08@oracle.com> Gentlepeople, The W3C's XML Query Working Group and XSL Working Group are pleased to announce the availability of version 1.0.0 of the Query and XPath Full Text 1.0 Test Suite (XQFTTS) at http://dev.w3.org/2007/xpath-full-text-10-test-suite/. XQFTTS 1.0.0 is the initial public release of this test suite. This release contains approximately 650 XQuery and XPath Full Text 1.0 tests embedded into either XQuery 1.0 expressions or XPath 2.0 expressions. We encourage implementors of XQuery and XPath Full Text to run XQFTTS 1.0.0 and send us their implementation reports. Implementors who are familiar with the XML Query Test Suite (XQTS) found at http://www.w3.org/XML/Query/test-suite/ will discover that the mechanisms used to run the two test suites are substantially identical. XQFTTS 1.0.0 does not contain any tests expressed in the XML syntax, known as XQueryX. A follow-up release of XQFTTS is planned for the very near future that adds the XQueryX tests to the existing tests. We look forward to receiving reports that demonstrate sufficient implementation experience to enable us to transition to Proposed Recommendation in the third quarter or fourth quarter of 2009. We will continue to maintain and enhance the test suite after our transition to Proposed Recommendation. Jim, Chair of the W3C XML Query WG On behalf of Sharon Adler, Chair of the W3C XSL WG ======================================================================== Jim Melton --- Editor of ISO/IEC 9075-* (SQL) Phone: +1.801.942.0144 Chair, W3C XML Query WG; XQX (etc.) editor Fax : +1.801.942.3345 Oracle Corporation Oracle Email: jim dot melton at oracle dot com 1930 Viscounti Drive Standards email: jim dot melton at acm dot org Sandy, UT 84093-1063 USA Personal email: jim at melton dot name ======================================================================== = Facts are facts. But any opinions expressed are the opinions = = only of myself and may or may not reflect the opinions of anybody = = else with whom I may or may not have discussed the issues at hand. = ======================================================================== -------------- next part -------------- An HTML attachment was scrubbed... URL: http://x-query.com/pipermail/talk/attachments/20090710/128031d6/attachment.htm From adam.retter at googlemail.com Fri Jul 10 20:14:30 2009 From: adam.retter at googlemail.com (Adam Retter) Date: Fri Jul 10 11:14:33 2009 Subject: [xquery-talk] dynamic xhtml with xquery In-Reply-To: <1be6002b0907101110p45246281ve8801f1e4de52c49@mail.gmail.com> References: <1be6002b0907100951m7510cc14jc7468e25182eb869@mail.gmail.com> <1be6002b0907101110p45246281ve8801f1e4de52c49@mail.gmail.com> Message-ID: No worries, if it happens that its a more generic XQuery question please do post back here. Some example code to see how your doing what your doing would help as well. 2009/7/10 Gary Lewis : > Hi Adam - It did not occur to me that it might be related to zorba. > I'll write their mailing list. Thanks. ... Gary > > > On Fri, Jul 10, 2009 at 1:32 PM, Adam Retter wrote: >> It sounds like you have some sort of text/xml serialization issue, >> your enquiry sounds quite specific to Zorba, have you tried their >> mailing list yet? >> >> >> >> 2009/7/10 Gary Lewis : >>> I'm stuck on a problem that must occur frequently, yet lots of >>> reading, google searches, and xquery experimentation have not >>> yet provided a solution. I'm writing in hopes that someone can point >>> me to an faq or similar info. >>> >>> Here's the situation. I'd like to use xquery to write dynamic xhtml >>> (ie, to write xhtml on-the-fly that can be viewed in a browser without >>> additional editing). >>> >>> I started with a small project involving rss, using zorba's xquery >>> REST functionality and GET to access the rss (returned as xml). I then >>> wrote an xquery to serialize the xml and return xhtml. No problems >>> when displayed in a browser (Firefox) ... except for special >>> characters. As you'd expect, the GET returns angle brackets as < >>> and > and since the rss contains many href links there >>> are many of these < and > substitutions. The browser renders >>> them correctly as > and < but, naturally, the resulting href is >>> seen as text and not as a link. >>> >>> I've tried lots of different possible solutions, all of which I >>> realize now were silly although useful for learning what not to do. >>> >>> Any help would be much appreciated. >>> >>> Thanks. >>> >>> Gary Lewis >>> _______________________________________________ >>> talk@x-query.com >>> http://x-query.com/mailman/listinfo/talk >>> >> >> >> >> -- >> Adam Retter >> >> sip:adam.retter@ekiga.net >> http://www.adamretter.org.uk >> > -- Adam Retter sip:adam.retter@ekiga.net http://www.adamretter.org.uk From mike at saxonica.com Fri Jul 10 20:15:50 2009 From: mike at saxonica.com (Michael Kay) Date: Fri Jul 10 11:15:55 2009 Subject: [xquery-talk] dynamic xhtml with xquery In-Reply-To: <1be6002b0907100951m7510cc14jc7468e25182eb869@mail.gmail.com> References: <1be6002b0907100951m7510cc14jc7468e25182eb869@mail.gmail.com> Message-ID: <1A675C8ABA664D36A0AFF4F6BFDAB3F8@Sealion> If your input contains escaped markup that you want to treat as markup then you have to unescape it. The easiest way to do that is to put it through an XML parser. Unfortunately there's no standard XQuery function to do that. Saxon has saxon:parse(), other products may have similar extensions, or you may be able to write your own. A better solution is to persuade people not to escape their markup... Regards, Michael Kay http://www.saxonica.com/ http://twitter.com/michaelhkay > -----Original Message----- > From: talk-bounces@x-query.com > [mailto:talk-bounces@x-query.com] On Behalf Of Gary Lewis > Sent: 10 July 2009 17:52 > To: talk@x-query.com > Subject: [xquery-talk] dynamic xhtml with xquery > > I'm stuck on a problem that must occur frequently, yet lots > of reading, google searches, and xquery experimentation have > not yet provided a solution. I'm writing in hopes that > someone can point me to an faq or similar info. > > Here's the situation. I'd like to use xquery to write dynamic > xhtml (ie, to write xhtml on-the-fly that can be viewed in a > browser without additional editing). > > I started with a small project involving rss, using zorba's > xquery REST functionality and GET to access the rss (returned > as xml). I then wrote an xquery to serialize the xml and > return xhtml. No problems when displayed in a browser > (Firefox) ... except for special characters. As you'd expect, > the GET returns angle brackets as < and > and since the > rss contains many href links there are many of these < and > > substitutions. The browser renders them correctly as > > and < but, naturally, the resulting href is seen as text and > not as a link. > > I've tried lots of different possible solutions, all of which > I realize now were silly although useful for learning what not to do. > > Any help would be much appreciated. > > Thanks. > > Gary Lewis > _______________________________________________ > talk@x-query.com > http://x-query.com/mailman/listinfo/talk From gary.m.lewis at gmail.com Fri Jul 10 15:30:55 2009 From: gary.m.lewis at gmail.com (Gary Lewis) Date: Fri Jul 10 11:30:58 2009 Subject: [xquery-talk] dynamic xhtml with xquery In-Reply-To: <1A675C8ABA664D36A0AFF4F6BFDAB3F8@Sealion> References: <1be6002b0907100951m7510cc14jc7468e25182eb869@mail.gmail.com> <1A675C8ABA664D36A0AFF4F6BFDAB3F8@Sealion> Message-ID: <1be6002b0907101130xcefe75cn4daec4e2410e607e@mail.gmail.com> Michael, Adam - Thanks to both of you for responding. I'll pull together some brief documentation of the problem so you can see it for yourselves. I cannot do that until Monday, however. More then. ... Gary On Fri, Jul 10, 2009 at 2:15 PM, Michael Kay wrote: > If your input contains escaped markup that you want to treat as markup then > you have to unescape it. The easiest way to do that is to put it through an > XML parser. Unfortunately there's no standard XQuery function to do that. > Saxon has saxon:parse(), other products may have similar extensions, or you > may be able to write your own. > > A better solution is to persuade people not to escape their markup... > > Regards, > > Michael Kay > http://www.saxonica.com/ > http://twitter.com/michaelhkay > > > >> -----Original Message----- >> From: talk-bounces@x-query.com >> [mailto:talk-bounces@x-query.com] On Behalf Of Gary Lewis >> Sent: 10 July 2009 17:52 >> To: talk@x-query.com >> Subject: [xquery-talk] dynamic xhtml with xquery >> >> I'm stuck on a problem that must occur frequently, yet lots >> of reading, google searches, and xquery experimentation have >> not yet provided a solution. I'm writing in hopes that >> someone can point me to an faq or similar info. >> >> Here's the situation. I'd like to use xquery to write dynamic >> xhtml (ie, to write xhtml on-the-fly that can be viewed in a >> browser without additional editing). >> >> I started with a small project involving rss, using zorba's >> xquery REST functionality and GET to access the rss (returned >> as xml). I then wrote an xquery to serialize the xml and >> return xhtml. No problems when displayed in a browser >> (Firefox) ... except for special characters. As you'd expect, >> the GET returns angle brackets as < and > and since the >> rss contains many href links there are many of these < and >> > substitutions. The browser renders them correctly as > >> and < but, naturally, the resulting href is seen as text and >> not as a link. >> >> I've tried lots of different possible solutions, all of which >> I realize now were silly although useful for learning what not to do. >> >> Any help would be much appreciated. >> >> Thanks. >> >> Gary Lewis >> _______________________________________________ >> talk@x-query.com >> http://x-query.com/mailman/listinfo/talk > > From gkholman at CraneSoftwrights.com Sun Jul 12 13:01:17 2009 From: gkholman at CraneSoftwrights.com (G. Ken Holman) Date: Sun Jul 12 00:14:07 2009 Subject: [xquery-talk] Announce: Hands-on XQuery/XSLT/XPath and XSL-FO training in Walnut Creek, California August 2009 [XQuery Talk] Message-ID: <7.0.1.0.2.20090712120101.02522b18@CraneSoftwrights.com> Announcing Crane's Summer Sessions! Based on the success of the same training in Santa Ana in early June, one of the attendees at those classes has arranged for Crane to deliver our training event in the East Bay area of Central California for his fellow Masters students before their return to classes late August: XSLT/XQuery/XPath - August 3-7, 2009 XSL-FO - August 10-12, 2009 http://www.CraneSoftwrights.com/index.html#Crane200908CA These are the most in-depth configurations of Crane's XSL and XQuery training classes, covering the use of every element, every attribute, every keyword and every function of both XSLT/XPath 1.0 and 2.0 and XQuery 1.0, and every formatting object of XSL-FO 1.0 and 1.1 with more detail and more exercises than other available configurations of our material. Practical Transformation Using XSLT, XQuery and XPath (5 days): http://www.CraneSoftwrights.com/training/ptuxq/ptuxqsyl.htm Practical Formatting Using XSL-FO (3 days): http://www.CraneSoftwrights.com/training/pfux/pfuxsyl.htm Venue - Embassy Suites, Walnut Creek (Pleasant Hill BART), California http://tinyurl.com/nljjbk Instructor/author: http://www.CraneSoftwrights.com/bio/gkholman.htm Early-bird date for discounted registration: July 20, 2009 If you are interested in having us teach publicly or privately in any area of the world, please let us know. Thanks! . . . . . . . . . Ken cc: XSL-List, XQuery Talk, XML-Doc, RenderX, Antenna House, XSL-FO-WWW, XSL-FO-Yahoo, XML-L p.s. We recognize these are difficult economic times for many companies, but thankfully air fares are low. For those who still cannot make it to the new class, we have extended the free worldwide shipping of our hyperlinked interactive 24-hour XSLT DVD-ROM video product: http://www.CraneSoftwrights.com/training/ptux/ptux-video.htm -- XQuery/XSLT/XSL-FO hands-on training - Oakland, CA, USA 2009-08-03 Crane Softwrights Ltd. http://www.CraneSoftwrights.com/q/ Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video Video lesson: http://www.youtube.com/watch?v=PrNjJCh7Ppg&fmt=18 Video overview: http://www.youtube.com/watch?v=VTiodiij6gE&fmt=18 G. Ken Holman mailto:gkholman@CraneSoftwrights.com Male Cancer Awareness Nov'07 http://www.CraneSoftwrights.com/q/bc Legal business disclaimers: http://www.CraneSoftwrights.com/legal From gary.m.lewis at gmail.com Mon Jul 13 17:44:35 2009 From: gary.m.lewis at gmail.com (Gary Lewis) Date: Mon Jul 13 13:30:50 2009 Subject: [xquery-talk] dynamic xhtml with xquery In-Reply-To: <1A675C8ABA664D36A0AFF4F6BFDAB3F8@Sealion> References: <1be6002b0907100951m7510cc14jc7468e25182eb869@mail.gmail.com> <1A675C8ABA664D36A0AFF4F6BFDAB3F8@Sealion> Message-ID: <1be6002b0907131344x2e2412a9s3349e8a1a28e35d7@mail.gmail.com> Michael got the diagnosis right (escaped markup) even though I didn't have the words to describe the problem accurately. Today I read Norman Walsh's 2003 article in xml.com on escaped markup. My simple question to this mailing list suddenly looks like a can of worms. And a google search of the topic turned up many other discussions of the problem. Yikes! Guess I'll let go of this problem temporarily. If anyone knows of an "easy-read" on escaped markup suitable for an xquery rookie, please let me know. Thanks. Gary Lewis On Fri, Jul 10, 2009 at 2:15 PM, Michael Kay wrote: > If your input contains escaped markup that you want to treat as markup then > you have to unescape it. The easiest way to do that is to put it through an > XML parser. Unfortunately there's no standard XQuery function to do that. > Saxon has saxon:parse(), other products may have similar extensions, or you > may be able to write your own. > > A better solution is to persuade people not to escape their markup... > > Regards, > > Michael Kay > http://www.saxonica.com/ > http://twitter.com/michaelhkay > > > >> -----Original Message----- >> From: talk-bounces@x-query.com >> [mailto:talk-bounces@x-query.com] On Behalf Of Gary Lewis >> Sent: 10 July 2009 17:52 >> To: talk@x-query.com >> Subject: [xquery-talk] dynamic xhtml with xquery >> >> I'm stuck on a problem that must occur frequently, yet lots >> of reading, google searches, and xquery experimentation have >> not yet provided a solution. I'm writing in hopes that >> someone can point me to an faq or similar info. >> >> Here's the situation. I'd like to use xquery to write dynamic >> xhtml (ie, to write xhtml on-the-fly that can be viewed in a >> browser without additional editing). >> >> I started with a small project involving rss, using zorba's >> xquery REST functionality and GET to access the rss (returned >> as xml). I then wrote an xquery to serialize the xml and >> return xhtml. No problems when displayed in a browser >> (Firefox) ... except for special characters. As you'd expect, >> the GET returns angle brackets as < and > and since the >> rss contains many href links there are many of these < and >> > substitutions. The browser renders them correctly as > >> and < but, naturally, the resulting href is seen as text and >> not as a link. >> >> I've tried lots of different possible solutions, all of which >> I realize now were silly although useful for learning what not to do. >> >> Any help would be much appreciated. >> >> Thanks. >> >> Gary Lewis >> _______________________________________________ >> talk@x-query.com >> http://x-query.com/mailman/listinfo/talk > > From andrew.j.welch at gmail.com Tue Jul 14 10:06:02 2009 From: andrew.j.welch at gmail.com (Andrew Welch) Date: Tue Jul 14 00:43:30 2009 Subject: [xquery-talk] dynamic xhtml with xquery In-Reply-To: <1be6002b0907131344x2e2412a9s3349e8a1a28e35d7@mail.gmail.com> References: <1be6002b0907100951m7510cc14jc7468e25182eb869@mail.gmail.com> <1A675C8ABA664D36A0AFF4F6BFDAB3F8@Sealion> <1be6002b0907131344x2e2412a9s3349e8a1a28e35d7@mail.gmail.com> Message-ID: <74a894af0907140106w4cf4565dmdbf54f471635f0df@mail.gmail.com> If you want to process RSS then I'm afraid it's far too much of a mess to not preprocess, unless you are only transforming feeds from sources you know generate good feeds. I recently wrote a small app to process feeds from all over the world. The goal was to process the contents of the feed, the stuff that is nearly always escaped or wrapped in CDATA. In the end I had to: - Run each escaped/CDATA section through tagsoup to create well-formed XML (to convert the characters to markup) - Post processes the result to convert entity references to character references - Transform that with XSLT Certain feeds would fail with parse errors using my app, but work with Google Reader (and various others) so I wonder if they use XML tools to process the feeds... (I cant see them jump through the same hoops I did) Basically RSS annoyed me a lot - what's the point of using XML if you can't process it as XML. It may be that people tasked with authoring the feeds struggled to generate well-formed XML (because perhaps they used non-XML tools to create the feeds) and then took the easy but misguided option of escaping/CDATA. Or perhaps because a lot of the feeds are loaded with adverts, they wanted to readers to be forced to treat the contents as a single lump... Either way, writing a feed reader that processes the feeds (rather than just copies them to the output) isn't trivial. 2009/7/13 Gary Lewis : > Michael got the diagnosis right (escaped markup) even though I didn't > have the words to describe the problem accurately. > > Today I read Norman Walsh's 2003 article in xml.com on escaped markup. > My simple question to this mailing list suddenly looks like a can of > worms. And a google search of the topic turned up many other > discussions of the problem. > > Yikes! Guess I'll let go of this problem temporarily. > > If anyone knows of an "easy-read" on escaped markup suitable for an > xquery rookie, please let me know. > > Thanks. > Gary Lewis > > On Fri, Jul 10, 2009 at 2:15 PM, Michael Kay wrote: >> If your input contains escaped markup that you want to treat as markup then >> you have to unescape it. The easiest way to do that is to put it through an >> XML parser. Unfortunately there's no standard XQuery function to do that. >> Saxon has saxon:parse(), other products may have similar extensions, or you >> may be able to write your own. >> >> A better solution is to persuade people not to escape their markup... >> >> Regards, >> >> Michael Kay >> http://www.saxonica.com/ >> http://twitter.com/michaelhkay >> >> >> From mail at martin-probst.com Tue Jul 14 11:33:35 2009 From: mail at martin-probst.com (Martin Probst) Date: Tue Jul 14 01:10:41 2009 Subject: [xquery-talk] dynamic xhtml with xquery In-Reply-To: <74a894af0907140106w4cf4565dmdbf54f471635f0df@mail.gmail.com> References: <1be6002b0907100951m7510cc14jc7468e25182eb869@mail.gmail.com> <1A675C8ABA664D36A0AFF4F6BFDAB3F8@Sealion> <1be6002b0907131344x2e2412a9s3349e8a1a28e35d7@mail.gmail.com> <74a894af0907140106w4cf4565dmdbf54f471635f0df@mail.gmail.com> Message-ID: <6dca08520907140133o2d930bf1qe03214d2b5829403@mail.gmail.com> > Certain feeds would fail with parse errors using my app, but work with > Google Reader (and various others) so I wonder if they use XML tools > to process the feeds... (I cant see them jump through the same hoops I > did) > Basically RSS annoyed me a lot - what's the point of using XML if you > can't process it as XML. It may be that people tasked with authoring > the feeds struggled to generate well-formed XML I think most people wrestling with XML use something like the Universal Feed Parser (http://www.feedparser.org/). It is more or less impossible to treat RSS as XML, as everybody on earth seems to get it wrong in one way or another (escaping, encoding, media type, ...). Also, the RSS specifications are notoriously ambiguous and generally broken - this is the reason why people created the Atom standard, which is much more sane. Martin From andrew.j.welch at gmail.com Tue Jul 14 11:28:45 2009 From: andrew.j.welch at gmail.com (Andrew Welch) Date: Tue Jul 14 02:02:43 2009 Subject: [xquery-talk] dynamic xhtml with xquery In-Reply-To: <6dca08520907140133o2d930bf1qe03214d2b5829403@mail.gmail.com> References: <1be6002b0907100951m7510cc14jc7468e25182eb869@mail.gmail.com> <1A675C8ABA664D36A0AFF4F6BFDAB3F8@Sealion> <1be6002b0907131344x2e2412a9s3349e8a1a28e35d7@mail.gmail.com> <74a894af0907140106w4cf4565dmdbf54f471635f0df@mail.gmail.com> <6dca08520907140133o2d930bf1qe03214d2b5829403@mail.gmail.com> Message-ID: <74a894af0907140228r678ed4e2jc522f1d9fe931afb@mail.gmail.com> > Also, the RSS specifications are notoriously ambiguous and generally > broken - this is the reason why people created the Atom standard, > which is much more sane. [way off topic] Yeah Atom seems wonderful in comparison... why? Because it's stricter and more predictable. Which makes me wonder about the success of RSS - is it because its so lax? There must be the same tricks and hacks being applied in feed readers all over the place, because each one has match the lowest common denominator - "google handles that feed, so your app has to process it too"... It's like browsers handling broken html in the past. The effort is moved from the content creator to the content processor.... and that means complex content processors and highly likely non-portable content. The lesson from HTML and RSS should be that markup needs to be strict, validated. It should fail early at "compile time" (the authoring stage, validation as you type) not at run time. That probably prevents early adoption, but its where lax languages seem to head after a few iterations. -- Andrew Welch http://andrewjwelch.com Kernow: http://kernowforsaxon.sf.net/ From rasmussen.bryan at gmail.com Thu Jul 16 09:35:30 2009 From: rasmussen.bryan at gmail.com (bryan rasmussen) Date: Wed Jul 15 23:18:49 2009 Subject: [xquery-talk] dynamic xhtml with xquery In-Reply-To: <74a894af0907140228r678ed4e2jc522f1d9fe931afb@mail.gmail.com> References: <1be6002b0907100951m7510cc14jc7468e25182eb869@mail.gmail.com> <1A675C8ABA664D36A0AFF4F6BFDAB3F8@Sealion> <1be6002b0907131344x2e2412a9s3349e8a1a28e35d7@mail.gmail.com> <74a894af0907140106w4cf4565dmdbf54f471635f0df@mail.gmail.com> <6dca08520907140133o2d930bf1qe03214d2b5829403@mail.gmail.com> <74a894af0907140228r678ed4e2jc522f1d9fe931afb@mail.gmail.com> Message-ID: <3bb44c6e0907152335q54ff2833x320136d99e2f86f0@mail.gmail.com> > Yeah Atom seems wonderful in comparison... why? Because it's stricter > and more predictable. ?Which makes me wonder about the success of RSS > - is it because its so lax? first to market (that wasn't from MS) >?There must be the same tricks and hacks > being applied in feed readers all over the place, because each one has > match the lowest common denominator - "google handles that feed, so > your app has to process it too"... ?It's like browsers handling broken > html in the past. I've been making an application that needs to do feedreading as part of it's functionality. I'm seeing escaped markup in Atom as well, so I guess this problem will not be handled by switch of format. Anyway my solution - which is doable in my application because its goal is to do presentation - is to do unescaping of the markup in the browser side via javascript when the user selects as particular subject. In fact I've gotten it going good enough that I've been able to move all feeds from google reader to my app. Of course this doesn't get around the fact that for some of the major XML languages out there it is basically not doable to do any efficient processing of them via the normal XML languages stack - don't look at the OPML!! Cheers, Bryan Rasmussen From marcus at mercatorit.com Fri Jul 17 11:24:38 2009 From: marcus at mercatorit.com (Marcus Clemens) Date: Fri Jul 17 01:53:17 2009 Subject: [xquery-talk] Statement of Work for Search specialist Message-ID: <9BCC2AEA2D8704498C240217CA020E3A3289B2@SERVER1.smallbusiness.local> Statement of Work for Search specialist .my client is looking to hire an experienced software engineer contractor/consultant initially for a period of 3 months with a possibility of a 3 month extension. The candidate's role is to help the Online library team with the implementation of the new search system based on MarkLogic..this is based in London and rates are good . I can help with a visa if you are interested in coming over from the USA The candidate will be working on an Agile project using XP practices, and will therefore be expected to be able to work using Pairing and Test Driven Development (TDD) on a daily basis. Skills/Work experience We expect the candidate to be a self-starter, who can take on problems or be part of a project team to deliver. The candidate needs to show strong interpersonal skills and the ability to communicate effectively with other members of the team, so that he/she can get the necessary information and support to get the work done. Skills include but should not be limited to: Essential skills: * Java / J2EE, Spring * XML, XSLT. XQUERY, XPATH * Knowledge on HTML, JavaScript, CSS and other popular technologies. * Understanding of search engine concepts ie content preparation (styling), search algorithms and languages, faceted results presentation, metasearching * Performance tuning of search engines and profilers * Keyword / key phrase research and generation. * Analysis and improvement of search results. * Unix/Windows working environments Desirable: * MarkLogic 4.0 * SQL Place of work The candidate is expected to work full-time in the WPS Ealing offices in London Start date ASAP Marcus Clemens Director & Senior Consultant Mercator IT Ltd Tel: 01892 611161 Fax: 01892 660185 Email: marcus@mercatorit.com Cooks Corner Business Park, The Old Saw Mill, London Road, Crowborough TN6 1TQ Registered in England no: 05755983 Registered office: 117 Dartford Road, Dartford, Kent DA1 3EN This email may contain privileged/confidential information and is for the intended addressee only. If you have received this message in error then you must not use, retain, disseminate or otherwise deal with it. Please notify the sender by return email and destroy. The views of the author may not necessarily constitute the views of Mercator IT Solutions Ltd. Nothing in this email shall bind Mercator IT Solutions Ltd in any contract or obligation. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://x-query.com/pipermail/talk/attachments/20090717/639186a8/attachment.htm