Hi Kashif,


My first guess would be that your stylesheet returns the output as element
nodes rather than a serialized string, and document-insert assumes .html
files should be stored as text files (which is the default), and therefore
flattens the output from xml to text, effectively stripping all tags.



Depending on what you actually want to do with the stored documents, you
can try to use xsl:output to set the output method to ‘html’. That should
force the xslt to serialize the output, but xsl:output could be ignored
altogether, not sure. If that doesn’t help you can use xdmp:quote to force
serialization yourself. If you actually prefer to keep the xml structure,
just pick an extension who’s mime-type is tied to the xml format, for
instance .xhtml..



Kind regards,

Geert



*Van:* [email protected] [mailto:
[email protected]] *Namens *Khan, Kashif
*Verzonden:* woensdag 10 juli 2013 21:11
*Aan:* MarkLogic Developer Discussion
*Onderwerp:* [MarkLogic Dev General] Applying XSLT on XML file using
xdmp:xslt-invoke



Hello everyone, I am having problem understanding the following issue. Any
help will be greatly appreciated



When I use the following code in query console the XSL gets applied and I
get the proper results



let $x := xdmp:xslt-invoke("/pipelines/HTML.xsl",
doc("/ancillary/20130626114719392MXENM08AAS2X_SE_080_03.xml"))

return $x



OUTPUT

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





But when I try to insert the output into a document I am NOT getting the
expected results



let $x := xdmp:xslt-invoke("/pipelines/HTML.xsl",
doc("/ancillary/20130626114719392MXENM08AAS2X_SE_080_03.xml"))

return xdmp:document-insert( '/ancillary/html/transformaed.html', $x,
xdmp:default-permissions(), () )



OUTPUT:

Here is what I find  when I look at the source of transformed.html file.
There are no tags just see extracted text below.



HTML Transformation 5 _ 9 What is the value of the underlined digit?53050900





————————————————

*Kashif Khan, PMI-ACP*
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to