Convert <br /> elements to <p /> during html copy
Questions about XML that are not covered by the other forums should go here.
-
- Posts: 38
- Joined: Thu Oct 28, 2010 5:10 pm
Convert <br /> elements to <p /> during html copy
Hello,
Is it possible to convert <br/> from legacy html to <p/> during copy and paste process?
I have some content from html, which I usually copy from the browser to oXygen in Author mode for further cleaning.
Hopefully there is a way to convert these <br/> elements to <p/> elements because I have a good number of them.
Thanks
Is it possible to convert <br/> from legacy html to <p/> during copy and paste process?
I have some content from html, which I usually copy from the browser to oXygen in Author mode for further cleaning.
Hopefully there is a way to convert these <br/> elements to <p/> elements because I have a good number of them.
Thanks
-
- Posts: 4141
- Joined: Fri Mar 28, 2003 2:12 pm
Re: Convert <br /> elements to <p /> during html copy
Post by sorin_ristache »
Hello,
The paste operation executed in Author mode just tries to transform the markup of the source HTML document to an equivalent one in the target document, that is a list/table/image/link/etc. will remain a list/table/image/link/etc. in the language of the target document (XHTML, DITA, DocBook, TEI). The paste operation does not transform a <br/> element to a <p/> one. I suggest creating and running an XSLT stylesheet on the XML document for adding the <p/> elements that will replace the <br/> ones.
Regards,
Sorin
The paste operation executed in Author mode just tries to transform the markup of the source HTML document to an equivalent one in the target document, that is a list/table/image/link/etc. will remain a list/table/image/link/etc. in the language of the target document (XHTML, DITA, DocBook, TEI). The paste operation does not transform a <br/> element to a <p/> one. I suggest creating and running an XSLT stylesheet on the XML document for adding the <p/> elements that will replace the <br/> ones.
Regards,
Sorin
-
- Posts: 4141
- Joined: Fri Mar 28, 2003 2:12 pm
Re: Convert <br /> elements to <p /> during html copy
Post by sorin_ristache »
If you paste in Author mode in a DITA topic file, a DocBook document, a TEI document or an XHTML one you can convert all <br/> elements to <p/> elements by modifying the XSLT stylesheet that does the conversion of the copied fragment:eloralon wrote:I have some content from html, which I usually copy from the browser to oXygen in Author mode for further cleaning.
Hopefully there is a way to convert these <br/> elements to <p/> elements because I have a good number of them.
- for DITA topics the XSLT stylesheet is [Oxygen-folder]\frameworks\dita\resources\xhtml2dita.xsl
- for DocBook 4 the XSLT stylesheet is [Oxygen-folder]\frameworks\docbook\resources\xhtml2db4.xsl
- for DocBook 5 the XSLT stylesheet is [Oxygen-folder]\frameworks\docbook\resources\xhtml2db5.xsl
- for TEI 4 the XSLT stylesheet is [Oxygen-folder]\frameworks\tei\resources\xhtml2tei4.xsl
- for TEI 5 the XSLT stylesheet is [Oxygen-folder]\frameworks\tei\resources\xhtml2tei5.xsl
- for XHTML the XSLT stylesheet is [Oxygen-folder]\frameworks\xhtml\resources\xhtml2xhtml.xsl
Regards,
Sorin
-
- Posts: 38
- Joined: Thu Oct 28, 2010 5:10 pm
Re: Convert <br /> elements to <p /> during html copy
Thanks Sorin for your reply,
Since I have a very rudimentary understanding of xslt because I am still learning it. Would you please tell me how to go about the change for the <br/> conversion to <p/>?
Looking through the xslt style sheet for html to DITA I saw the following template:, which I think needs to be copied and modified for my purpose. Trouble is that I don't really know how to?
Thanks.
Loralon
Since I have a very rudimentary understanding of xslt because I am still learning it. Would you please tell me how to go about the change for the <br/> conversion to <p/>?
Looking through the xslt style sheet for html to DITA I saw the following template:
Code: Select all
<xsl:template match="xhtml:p">
<xsl:choose>
<xsl:when test="not(parent::xhtml:th | parent::xhtml:td) and not(normalize-space(.) = '')">
<p>
<xsl:apply-templates select="@*"/>
<xsl:apply-templates select="." mode="checkHeadings"/>
</p>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="@*"/>
<xsl:apply-templates select="." mode="checkHeadings"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
Thanks.
Loralon
-
- Posts: 4141
- Joined: Fri Mar 28, 2003 2:12 pm
Re: Convert <br /> elements to <p /> during html copy
Post by sorin_ristache »
Hello,
Please look at some XSLT tutorials. Maybe some XSLT experts from the XSL-List mailing list can be more helpful.
Regards,
Sorin
Please look at some XSLT tutorials. Maybe some XSLT experts from the XSL-List mailing list can be more helpful.
Regards,
Sorin
Return to “General XML Questions”
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service