Pass the 'map' option to cts:element-values, and then use map operators. If you
need lexical order you can always sort the results in a FLWOR.
This illustrates the idea:
let $a := map:map()
let $_ := ('a', 'b', 'c', 'd') ! map:put($a, ., .)
let $b := map:map()
let $_ := ('c', 'd', 'e', 'f') ! map:put($b, ., .)
return map:keys($a * $b)
=> d c
You might also be interested in http://blakeley.com/blogofile/archives/560/ for
some other map-related tricks.
-- Mike
On 17 Jul 2013, at 14:32 , Abhishek53 S <[email protected]> wrote:
> Hi All,
>
> I am getting significant permance degradation in creating intersection
> between two big sequences.
>
> I am using following code for sequence intersecation
>
> let $sequence := cts:element-values(xs:QName("item1")) (:returns 3000 items:)
> let $sub-sequence := cts:element-values(xs:QName("item2")) (:returns 30
> items:)
> return
> fn:distinct-values($sequence[.= $sub-sequence]) (:Takes 5-6 sec:)
> Please let me know if there is some better way to address this
>
> Regards
>
> Abhishek Srivastav
> Tata Consultancy Services
> Cell:- +609-865-1885
>
> Mailto: [email protected]
> Website: http://www.tcs.com
> ____________________________________________
> Experience certainty. IT Services
> Business Solutions
> Consulting
> ____________________________________________
>
>
> [email protected] wrote: -----
>
> To: MarkLogic Developer Discussion <[email protected]>
> From: Erik Hennum <[email protected]>
> Sent by: [email protected]
> Date: 07/15/2013 06:43PM
> Subject: Re: [MarkLogic Dev General] Applying XSLT on XML file using
> xdmp:xslt-invoke
>
> Hi, Kashif:
>
> The XSLT transform copies the element from a document where the default
> namespace is "http://www.imsglobal.org/xsd/imsqti_v2p1"
>
> <xsl:copy-of select="choiceInteraction/prompt/p" />
>
> As a result, the copied element still doesn't have a default XHTML namespace:
>
> <p ... xmlns="http://www.imsglobal.org/xsd/imsqti_v2p1">...
>
> You might want to assign a prefix to that namespace and add a transform rule
> that recursively matches any element in that namespace and emits the same
> local name in the XHTML namespace.
>
>
> Hoping that helps,
>
>
> Erik Hennum
>
> ________________________________________
> From: [email protected]
> [[email protected]] on behalf of Khan, Kashif
> [[email protected]]
> Sent: Monday, July 15, 2013 1:52 PM
> To: MarkLogic Developer Discussion
> Subject: Re: [MarkLogic Dev General] Applying XSLT on XML file using
> xdmp:xslt-invoke
>
> Erik, still the same issue. Applying xdmp:quote gives me the correct
> transformation by as soon as I insert it into a file all the tags are gone.
>
> Here is my XSLT
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns:xd="http://www.oxygenxml.com/ns/doc/xsl"
> xmlns:xh="http://www.w3.org/1999/xhtml"
> xpath-default-namespace="http://www.imsglobal.org/xsd/imsqti_v2p1"
> exclude-result-prefixes="xs xd"
> version="2.0">
> <xsl:template match="assessmentItem"> <xh:html
> xmlns='http://www.w3.org/1999/xhtml'>
> <xh:head/>
> <xh:title>HTML Transformation</xh:title>
> <xh:body>
> <xsl:apply-templates select="itemBody"/>
> <xsl:apply-templates
> select="itemBody/choiceInteraction"/>
> </xh:body>
> </xh:html>
> </xsl:template>
>
> <xsl:template match="itemBody">
> <xh:p>
> <xh:img src="{choiceInteraction/prompt/img/@src}"
> alt="{choiceInteraction/prompt/img/@alt}"/>
> <xsl:copy-of select="choiceInteraction/prompt/p" />
> </xh:p>
> </xsl:template>
> <xsl:template match="itemBody/choiceInteraction">
>
> <xsl:for-each select="simpleChoice">
> <xh:input type="radio" value="{@identifier}">
> <xsl:value-of select="."/><xh:br/>
> </xh:input>
> </xsl:for-each>
> <xh:input type="submit" name="submit" />
> </xsl:template>
> </xsl:stylesheet>
>
> Here is the output after applying xdmp:quote on the output
>
> <html xmlns:xh="http://www.w3.org/1999/xhtml"
> xmlns="http://www.w3.org/1999/xhtml">
> <head>
> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
> </head>
> <title>HTML Transformation</title>
> <body><p><img src="images/MNMTPG2_SE_062_3T_V1_ANS.jpg" alt="" /><p
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:math="http://www.w3.org/1998/Math/MathML"
> xmlns="http://www.imsglobal.org/xsd/imsqti_v2p1">
> <span xmlns="http://www.harcourt.com/HSP">
> <math:math>
> <math:munder accentunder="true">
> <math:mn>5</math:mn>
> <math:mo stretchy="true">_</math:mo>
> </math:munder>
> <math:mn>9</math:mn>
> </math:math>
> </span>
> </p><p xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:math="http://www.w3.org/1998/Math/MathML"
> xmlns="http://www.imsglobal.org/xsd/imsqti_v2p1">What is the value of the
> underlined digit?</p></p><input type="radio" value="a" />5<br /><input
> type="radio" value="b" />30<br /><input type="radio" value="c" />50<br
> /><input type="radio" value="d" />900<br /><input type="submit"
> name="submit" /></body>
> </html>
>
>
>
> ————————————————
> Kashif Khan, PMI-ACP
> Sr. Solution Architect
> Publishing Technology
>
> Houghton Mifflin Harcourt
> 9400 South Park Center Loop
> Orlando, FL 32819
> Office: 407.345.3420
> Mobile: 407.949.4697
> hmhco.com
>
>
>
>
>
>
> On 7/12/13 8:43 AM, "Erik Hennum" <[email protected]> wrote:
>
> >Hi, Kashif:
> >
> >If you look carefully at the namespaces, most of the p, span, input and
> >other elements are not in the XHTML namespace. So, even though the local
> >name is right, the browser won't recognize them as XHTML.
> >
> >Try modifying the namespace of those elements in your XSLT transform and
> >see if the browser renders them.
> >
> >
> >Erik Hennum
> >
> >________________________________________
> >From: [email protected]
> >[[email protected]] on behalf of Khan, Kashif
> >[[email protected]]
> >Sent: Thursday, July 11, 2013 2:51 PM
> >To: MarkLogic Developer Discussion
> >Subject: Re: [MarkLogic Dev General] Applying XSLT on XML file using
> >xdmp:xslt-invoke
> >
> >Mary this is what I get
> >
> ><?xml version="1.0" encoding="UTF-8"?>
> ><html xmlns="http://www.w3.org/1999/xhtml">
> > <title>HTML Transformation</title>
> > <p xmlns="">
> > <img src="images/MNMTPG2_SE_062_3T_V1_ANS.jpg" alt=""/>
> > <p xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> >xmlns:math="http://www.w3.org/1998/Math/MathML"
> >xmlns="http://www.imsglobal.org/xsd/imsqti_v2p1">
> > <span xmlns="http://www.harcourt.com/HSP">
> > <math:math>
> > <math:munder accentunder="true">
> > <math:mn>5</math:mn>
> > <math:mo stretchy="true">_</math:mo>
> > </math:munder>
> > <math:mn>9</math:mn>
> > </math:math>
> > </span>
> > </p>
> > <p xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> >xmlns:math="http://www.w3.org/1998/Math/MathML"
> >xmlns="http://www.imsglobal.org/xsd/imsqti_v2p1">What is the value of the
> >underlined digit?</p>
> > </p>
> > <input type="radio" value="a" xmlns="">5<br/></input>
> > <input type="radio" value="b" xmlns="">30<br/></input>
> > <input type="radio" value="c" xmlns="">50<br/></input>
> > <input type="radio" value="d" xmlns="">900<br/></input>
> > <input type="submit" name="submit" xmlns=""/>
> ></html>
> >
> >
> >
> >‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹
> >Kashif Khan, PMI-ACP
> >Sr. Solution Architect
> >Publishing Technology
> >
> >Houghton Mifflin Harcourt
> >9400 South Park Center Loop
> >Orlando, FL 32819
> >Office: 407.345.3420
> >Mobile: 407.949.4697
> >hmhco.com
> >
> >
> >
> >
> >
> >
> >On 7/11/13 5:36 PM, "Mary Holstege" <[email protected]> wrote:
> >
> >>On Thu, 11 Jul 2013 14:10:02 -0700, Khan, Kashif <[email protected]>
> >>wrote:
> >>
> >>> Thanks Greet I have made some head way after seeing your response. I
> >>>just save the file as transformaed.xhtml INSTEAD of transformed.html and
> >>>it started working. Below is the code that is now working in query
> >>>console
> >>>
> >>> let $x := xdmp:xslt-invoke("/pipelines/HTML.xsl",
> >>>doc("/ancillary/20130626114719392MXENM08AAS2X_SE_080_03.xml"))
> >>> return xdmp:document-insert('/ancillary/html/transformaed.xhtml', $x,
> >>>xdmp:default-permissions(), () )
> >>>
> >>> Now when I am integrating this approach in CPF I am back to the same
> >>>problem where all the html tags are getting stripped out. Below is the
> >>>action file for my pipeline. I have tried using xsl:output and it does
> >>>not seem to help. When I use xdmp:quote it starts throwing error.
> >>
> >>The format of a document stored via xdmp:document-insert
> >>is not determined by its URI, only by the content.
> >>So if you give it XML, it is saved as XML; if you
> >>give it text, it is saved as text.
> >>
> >>What is your stylesheet producing? What output
> >>method.
> >>
> >>So I would back up and verify that it isn't getting
> >>saved correctly, because I suspect the issue is
> >>how the content is being displayed. What you
> >>describe looks like what a browser does when it
> >>is given XML that it doesn't recognize as HTML.
> >>QConsole has a lot of layers of interpretation
> >>between you and the actual results, so it can
> >>mislead you sometimes.
> >>
> >>What does the raw text output show you?
> >>What does xdmp:quote(doc("/ancillary/html/transformed.html"))
> >>show you?
> >>
> >>//Mary
> >>_______________________________________________
> >>General mailing list
> >>[email protected]
> >>http://developer.marklogic.com/mailman/listinfo/general
> >>
> >
> >
> >_______________________________________________
> >General mailing list
> >[email protected]
> >http://developer.marklogic.com/mailman/listinfo/general
> >_______________________________________________
> >General mailing list
> >[email protected]
> >http://developer.marklogic.com/mailman/listinfo/general
> >
>
> _______________________________________________
> General mailing list
> [email protected]
> http://developer.marklogic.com/mailman/listinfo/general
> _______________________________________________
> General mailing list
> [email protected]
> http://developer.marklogic.com/mailman/listinfo/general
>
> =====-----=====-----=====
> Notice: The information contained in this e-mail
> message and/or attachments to it may contain
> confidential or privileged information. If you are
> not the intended recipient, any dissemination, use,
> review, distribution, printing or copying of the
> information contained in this e-mail message
> and/or attachments to it are strictly prohibited. If
> you have received this communication in error,
> please notify us by reply e-mail or telephone and
> immediately and permanently delete the message
> and any attachments. Thank you
>
>
> _______________________________________________
> General mailing list
> [email protected]
> http://developer.marklogic.com/mailman/listinfo/general
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general