[MarkLogic Dev General] XSLT insted of XQuery in ML7

Rahul Singh rahulsinghindia15 at gmail.com
Wed Jan 27 10:39:47 PST 2016


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.html 


More information about the General mailing list