Hi, Kashif:

It seems that the problem occurs when a library or tool tries to interpret your 
document as HTML.  QueryConsole doesn't try to interpret your document as HTML. 
 It processes your document as XML, and the problem never arises in XML 
processing.

My understanding (caveat:  I've never used the CPF HTML conversion) from the 
docs:

    http://docs.marklogic.com/guide/cpf/overview#id_73708

is that the CPF HTML conversion invokes Tidy to convert HTML to XHTML.  

I suspect that, like the web browsers, Tidy considers the namespace as well as 
the local name and doesn't consider the a p element in the wrong namespace to 
be an HTML element.  (That would be correct according to the XHTML standard.)  
That would explain why Tidy would keep the text and throw away the element.  

If you modify your transform to change the namespace to the XHTML namespace, 
you should be able to process the document with XHTML tools.  Also, given that 
your document will already be XHTML, there may not be a reason to run it 
through the CPF conversion.


Hoping that helps,


Erik Hennum

________________________________________
From: [email protected] 
[[email protected]] on behalf of Khan, Kashif 
[[email protected]]
Sent: Friday, July 19, 2013 3:25 PM
To: MarkLogic Developer Discussion
Subject: Re: [MarkLogic Dev General] Applying XSLT on XML file using 
xdmp:xslt-invoke

Erik, you mentioned in your previous email about assigning a prefix to the
name space. But it does not explain why it is working for me when I do the
same operation using query console. Here is what I am doing in query
console.

let $x := xdmp:xslt-invoke("/pipelines/HTML.xsl",
doc("/ancillary/20130626114719392MXENM08AAS2X_SE_080_03.xml"))
xdmp:document-insert('/ancillary/html/transformaed2.xhtml', $x,
xdmp:default-permissions(), () )






————————————————
Kashif Khan, PMI-ACP






On 7/15/13 4:58 PM, "Khan, Kashif" <[email protected]> wrote:

>Its interesting when I insert the transformed output into a file e.g.
>transformed.html using  query console everything is looking good. I get a
>properly formatted html file.
>
>BUT When I do it using CPF the same operation take away all the html tags.
>All I get is the extracted text in the transformed.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/15/13 4:52 PM, "Khan, Kashif" <[email protected]> wrote:
>
>>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
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to