[restored the subject line] Yes, Rahul, it should work regardless of how many commas there are, assuming all the children have the same number of commas. It can also support more columns, just by adding to the match="a | E | s" pattern, or better yet, changing it to match="Inv/*".
Evan Lenz President, Lenz Consulting Group, Inc. http://lenzconsulting.com On Wed, Jan 27, 2016 at 11:29 AM, Rahul Singh <[email protected]> wrote: > Thanks Lenz for your prompt response. > > I am implementing splitter by xslt which is already implemented in xquery > in ML7. > > I need to know if I have more then one or two comma (,) sepreted in input > then can we get expected output as per your xslt. > > > On Thursday, January 28, 2016, <[email protected]> > wrote: > >> Send General mailing list submissions to >> [email protected] >> >> To subscribe or unsubscribe via the World Wide Web, visit >> http://developer.marklogic.com/mailman/listinfo/general >> or, via email, send a message with subject or body 'help' to >> [email protected] >> >> You can reach the person managing the list at >> [email protected] >> >> When replying, please edit your Subject line so it is more specific >> than "Re: Contents of General digest..." >> >> >> Today's Topics: >> >> 1. MarkLogic Upgrade from 6 to 8 (Khan, Kashif) >> 2. Re: MarkLogic Upgrade from 6 to 8 (Paul Hoehne) >> 3. XSLT insted of XQuery in ML7 (Rahul Singh) >> 4. Re: XSLT insted of XQuery in ML7 (Evan Lenz) >> >> >> ---------------------------------------------------------------------- >> >> Message: 1 >> Date: Wed, 27 Jan 2016 16:38:11 +0000 >> From: "Khan, Kashif" <[email protected]> >> Subject: [MarkLogic Dev General] MarkLogic Upgrade from 6 to 8 >> To: MarkLogic Developer Discussion <[email protected]> >> Message-ID: <d2ce5c9f.7919f%[email protected]> >> Content-Type: text/plain; charset="windows-1252" >> >> Hello Everyone, >> >> We just upgraded our MarkLogic server from version 6 to latest version 8. >> Now when we try to restart the MarkLogic server we are getting the >> following error. Does anyone know what is happening here. >> >> Starting MarkLogic: /opt/MarkLogic/bin/MarkLogic: error while loading >> shared libraries: libsasl2.so.3: cannot open shared object file: No such >> file or directory >> >> >> Best Regards, >> Kashif Khan >> -------------- next part -------------- >> An HTML attachment was scrubbed... >> URL: >> http://developer.marklogic.com/pipermail/general/attachments/20160127/b47cf6aa/attachment-0001.html >> >> ------------------------------ >> >> Message: 2 >> Date: Wed, 27 Jan 2016 16:48:24 +0000 >> From: Paul Hoehne <[email protected]> >> Subject: Re: [MarkLogic Dev General] MarkLogic Upgrade from 6 to 8 >> To: MarkLogic Developer Discussion <[email protected]> >> Message-ID: <[email protected]> >> Content-Type: text/plain; charset="utf-8" >> >> This is what I would check first. (Although I?ve never run into this >> specific problem). Check to make sure that you meet the Linux/Unix >> guidelines in the install documents. But usually Sasl is installed as part >> of the LDAP client libraries. If you do have a version of libsasl present, >> and it?s the current version for your linux (maybe it?s libsasl2.so.3), you >> can symbolically link it to libsasl2.so.2. Also, make sure you have the 64 >> bit version installed for 64 bit MarkLogic. >> >> From: <[email protected]<mailto: >> [email protected]>> on behalf of "Khan, Kashif" < >> [email protected]<mailto:[email protected]>> >> Reply-To: MarkLogic Developer Discussion <[email protected] >> <mailto:[email protected]>> >> Date: Wednesday, January 27, 2016 at 11:38 AM >> To: MarkLogic Developer Discussion <[email protected] >> <mailto:[email protected]>> >> Subject: [MarkLogic Dev General] MarkLogic Upgrade from 6 to 8 >> >> Hello Everyone, >> >> We just upgraded our MarkLogic server from version 6 to latest version 8. >> Now when we try to restart the MarkLogic server we are getting the >> following error. Does anyone know what is happening here. >> >> Starting MarkLogic: /opt/MarkLogic/bin/MarkLogic: error while loading >> shared libraries: libsasl2.so.3: cannot open shared object file: No such >> file or directory >> >> >> Best Regards, >> Kashif Khan >> -------------- next part -------------- >> An HTML attachment was scrubbed... >> URL: >> http://developer.marklogic.com/pipermail/general/attachments/20160127/210aba04/attachment-0001.html >> >> ------------------------------ >> >> Message: 3 >> Date: Thu, 28 Jan 2016 00:09:47 +0530 >> From: Rahul Singh <[email protected]> >> Subject: [MarkLogic Dev General] XSLT insted of XQuery in ML7 >> To: [email protected], >> [email protected] >> Message-ID: >> <CAOHr718JWpGvfWPQL8O2XK5bfaOF14_z= >> [email protected]> >> Content-Type: text/plain; charset="utf-8" >> >> Hello, >> >> I have one requirement which is need to impelment in XSLT not in XQuery in >> ML7, but I need output as per given output, but it is not coming as per >> given: >> >> Input is: >> >> <IN> >> <Inv> >> <a>456,3F</a> >> <E>7a,8F</E> >> <s>M,c</s> >> </Inv> >> </IN> >> >> Expected Output: >> >> <IN> >> <Inv> >> <a>456</a> >> <E>7a</E> >> <s>M</s> >> </Inv> >> <Inv> >> <a>3F</a> >> <E>8F</E> >> <s>c</s> >> </Inv> >> </IN> >> >> >> XSLT is : >> >> <xsl:template match="/"> >> <IN> >> <xsl:for-each select="IN/Inv"> >> <Inv> >> <xsl:for-each select="tokenize(a, ',')"> >> <xsl:element name="a"> >> <xsl:value-of select="."/> >> </xsl:element> >> <xsl:if test="position() != last()"> </xsl:if> >> </xsl:for-each> >> <xsl:for-each select="tokenize(s, ',')"> >> <xsl:element name="s"> >> <xsl:value-of select="."/> >> </xsl:element> >> <xsl:if test="position() != last()"> </xsl:if> >> </xsl:for-each> >> <xsl:for-each select="tokenize(E, ',')"> >> <xsl:element name="E"> >> <xsl:value-of select="."/> >> </xsl:element> >> <xsl:if test="position() != last()"> </xsl:if> >> </xsl:for-each> >> </Inv> >> </xsl:for-each> >> </IN> >> </xsl:template> >> -------------- next part -------------- >> An HTML attachment was scrubbed... >> URL: >> http://developer.marklogic.com/pipermail/general/attachments/20160128/dbd97322/attachment-0001.html >> >> ------------------------------ >> >> Message: 4 >> Date: Wed, 27 Jan 2016 11:14:11 -0800 >> From: Evan Lenz <[email protected]> >> Subject: Re: [MarkLogic Dev General] XSLT insted of XQuery in ML7 >> To: MarkLogic Developer Discussion <[email protected]> >> Cc: [email protected] >> Message-ID: >> <CAGH2=xuk5SYruradaQbH9Wcu3euC0a800= >> [email protected]> >> Content-Type: text/plain; charset="utf-8" >> >> Hi Rahul, >> >> Your code will only create as many <Inv> elements as you have in the input >> (due to your use of <xsl:for-each select="IN/Inv">, which contains just >> one >> <Inv>). You would instead need to do an <xsl:for-each> on the tokenized >> string to get the right number of <Inv> elements in the result. >> >> Here's an alternative solution you could try. It has three rules: one rule >> for <Inv> (to replace it with as many <Inv> elements as there are >> comma-separated values in its first element child); one rule for <a>, <E>, >> and <s> (to copy the element, extracting the value according to the >> position of the current <Inv> being replicated); and one default rule (the >> identity transform, for copying everything unchanged): >> >> <xsl:stylesheet version="2.0" >> xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >> xmlns:xs="http://www.w3.org/2001/XMLSchema" >> exclude-result-prefixes="xs"> >> >> <xsl:template match="Inv"> >> <xsl:variable name="this-node" select="."/> >> <xsl:for-each select="tokenize(*[1],',')"> >> <xsl:apply-templates mode="replicate" select="$this-node"> >> <xsl:with-param name="pos" select="position()" tunnel="yes"/> >> </xsl:apply-templates> >> </xsl:for-each> >> </xsl:template> >> >> <xsl:template mode="replicate" match="a | E | s"> >> <xsl:param name="pos" tunnel="yes"/> >> <xsl:copy> >> <xsl:value-of select="tokenize(.,',')[$pos]"/> >> </xsl:copy> >> </xsl:template> >> >> <!-- By default, copy everything unchanged --> >> <xsl:template mode="#default replicate" match="@* | node()"> >> <xsl:copy> >> <xsl:apply-templates mode="#current" select="@* | node()"/> >> </xsl:copy> >> </xsl:template> >> >> </xsl:stylesheet> >> >> >> Evan Lenz >> President, Lenz Consulting Group, Inc. >> http://lenzconsulting.com >> >> >> On Wed, Jan 27, 2016 at 10:39 AM, Rahul Singh < >> [email protected]> >> wrote: >> >> > Hello, >> > >> > I have one requirement which is need to impelment in XSLT not in XQuery >> in >> > ML7, but I need output as per given output, but it is not coming as per >> > given: >> > >> > Input is: >> > >> > <IN> >> > <Inv> >> > <a>456,3F</a> >> > <E>7a,8F</E> >> > <s>M,c</s> >> > </Inv> >> > </IN> >> > >> > Expected Output: >> > >> > <IN> >> > <Inv> >> > <a>456</a> >> > <E>7a</E> >> > <s>M</s> >> > </Inv> >> > <Inv> >> > <a>3F</a> >> > <E>8F</E> >> > <s>c</s> >> > </Inv> >> > </IN> >> > >> > >> > XSLT is : >> > >> > <xsl:template match="/"> >> > <IN> >> > <xsl:for-each select="IN/Inv"> >> > <Inv> >> > <xsl:for-each select="tokenize(a, ',')"> >> > <xsl:element name="a"> >> > <xsl:value-of select="."/> >> > </xsl:element> >> > <xsl:if test="position() != last()"> </xsl:if> >> > </xsl:for-each> >> > <xsl:for-each select="tokenize(s, ',')"> >> > <xsl:element name="s"> >> > <xsl:value-of select="."/> >> > </xsl:element> >> > <xsl:if test="position() != last()"> </xsl:if> >> > </xsl:for-each> >> > <xsl:for-each select="tokenize(E, ',')"> >> > <xsl:element name="E"> >> > <xsl:value-of select="."/> >> > </xsl:element> >> > <xsl:if test="position() != last()"> </xsl:if> >> > </xsl:for-each> >> > </Inv> >> > </xsl:for-each> >> > </IN> >> > </xsl:template> >> > >> > >> > _______________________________________________ >> > General mailing list >> > [email protected] >> > Manage your subscription at: >> > http://developer.marklogic.com/mailman/listinfo/general >> > >> > >> -------------- next part -------------- >> An HTML attachment was scrubbed... >> URL: >> http://developer.marklogic.com/pipermail/general/attachments/20160127/f9adf818/attachment.html >> >> ------------------------------ >> >> _______________________________________________ >> General mailing list >> [email protected] >> Manage your subscription at: >> http://developer.marklogic.com/mailman/listinfo/general >> >> >> End of General Digest, Vol 139, Issue 71 >> **************************************** >> > > _______________________________________________ > General mailing list > [email protected] > Manage your subscription at: > http://developer.marklogic.com/mailman/listinfo/general > >
_______________________________________________ General mailing list [email protected] Manage your subscription at: http://developer.marklogic.com/mailman/listinfo/general
