wrap multiple <p> tags for conditional processing
Post here questions and problems related to editing and publishing DITA content.
-
- Posts: 7
- Joined: Thu Feb 22, 2024 2:03 pm
wrap multiple <p> tags for conditional processing
Post by petrepavlov »
Hi,
Is there a way to wrap multiple consecutive <p> tags with a single tag for conditional processing?
Example:
<p> This is line 1.</p>
<p>This is line 2.</p>
<p>This is line 3.</p>
.
.
.
<p>This is line N.</p>
I would like to conditionalize all N <p> tags at once, instead of using <ph> to wrap each <p> tag content individually.
Is there a way to wrap multiple consecutive <p> tags with a single tag for conditional processing?
Example:
<p> This is line 1.</p>
<p>This is line 2.</p>
<p>This is line 3.</p>
.
.
.
<p>This is line N.</p>
I would like to conditionalize all N <p> tags at once, instead of using <ph> to wrap each <p> tag content individually.
Re: wrap multiple <p> tags for conditional processing
Hello,
You can wrap multiple consecutive <p> elements in a DITA <div> [1].
[1] https://www.oxygenxml.com/dita/1.3/spec ... e/div.html
Best,
Cosmin
You can wrap multiple consecutive <p> elements in a DITA <div> [1].
[1] https://www.oxygenxml.com/dita/1.3/spec ... e/div.html
Best,
Cosmin
Cosmin Eftenie
www.oxygenxml.com
www.oxygenxml.com
-
- Posts: 7
- Joined: Thu Feb 22, 2024 2:03 pm
Re: wrap multiple <p> tags for conditional processing
Post by petrepavlov »
Thank you Cosmin.
I tried but the <div> tag is no allowed in the .dita files I am currently working on.
Any idea why?
I tried but the <div> tag is no allowed in the .dita files I am currently working on.
Any idea why?
- image.png (19.53 KiB) Viewed 1855 times
-
- Posts: 7
- Joined: Thu Feb 22, 2024 2:03 pm
Re: wrap multiple <p> tags for conditional processing
Hi,
How about if you try to create a new DITA XML topic file with the contents:
? Do you get validation errors in the topic? In general the <div> element can be used as a wrapped for block type elements like in my example above.
Regards,
Radu
How about if you try to create a new DITA XML topic file with the contents:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd">
<topic id="topic_f35_rtx_zbc">
<title>Title</title>
<body>
<div>
<p>Some paragraph1</p>
<p>Some paragraph2</p>
</div>
</body>
</topic>
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 7
- Joined: Thu Feb 22, 2024 2:03 pm
Re: wrap multiple <p> tags for conditional processing
Post by petrepavlov »
Hi Radu,
No validation errors when pasting the code below in a new DITA XML file. Any idea what to look for in my book?
Thanks.
No validation errors when pasting the code below in a new DITA XML file. Any idea what to look for in my book?
Thanks.
- image.png (29.17 KiB) Viewed 1794 times
Re: wrap multiple <p> tags for conditional processing
Hi,
I do not know what type of DITA XML topics you are working with, maybe you are using a DITA XML specialization which does not allow the use of the <div> element, this is not something we can control.
Regards,
Radu
I do not know what type of DITA XML topics you are working with, maybe you are using a DITA XML specialization which does not allow the use of the <div> element, this is not something we can control.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 7
- Joined: Thu Feb 22, 2024 2:03 pm
Re: wrap multiple <p> tags for conditional processing
Post by petrepavlov »
This is the XML for an actual file I am working on. Is this info enough to offer some suggestion?
- image.png (12.86 KiB) Viewed 1782 times
Re: wrap multiple <p> tags for conditional processing
Hi,
The <div> element can also be used inside DITA XML concept files, so something like this should be valid also on your side:
I think that maybe you had trouble inserting the <div> in the Author visual editing mode because you attempted to insert it inside a paragraph and not before or after a paragraph.
Regards,
Radu
The <div> element can also be used inside DITA XML concept files, so something like this should be valid also on your side:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE concept PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
<concept id="concept_n2l_bgf_1cc">
<title>Test</title>
<conbody>
<div>
<p>Some para1</p>
<p>Some para2</p>
</div>
</conbody>
</concept>
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 7
- Joined: Thu Feb 22, 2024 2:03 pm
Re: wrap multiple <p> tags for conditional processing
Post by petrepavlov »
Hi Radu,
It worked surronunding with <div></div> the concerned elements in text mode. Thank you!!!
However I cannot seem to surround with <div> several elements in Author mode. I tried:
- selecting the concerned elements and pressing [ENTER]
- inserting <div> outside <p> or any element that needed to be profiled
- using Refactoring -> Elements -> Wrap Element.
Is there any option that I might have missed in Author mode?
Should the option "Allow only insertion of valid elements and attributes" be disabled for this? How?
It worked surronunding with <div></div> the concerned elements in text mode. Thank you!!!
However I cannot seem to surround with <div> several elements in Author mode. I tried:
- selecting the concerned elements and pressing [ENTER]
- inserting <div> outside <p> or any element that needed to be profiled
- using Refactoring -> Elements -> Wrap Element.
Is there any option that I might have missed in Author mode?
Should the option "Allow only insertion of valid elements and attributes" be disabled for this? How?
- image.png (20.36 KiB) Viewed 1743 times
Re: wrap multiple <p> tags for conditional processing
Hi,
I'm not sure how you select the paragraphs, do you select them one by one by using the mouse? I'm selecting them by using shift with arrows starting before the first one and ending after the last one and things seem to work for me:
Anyway, here's a workaround, select the paragraphs as you want, Ctrl-X to cut them, ENTER, insert the <div> and then paste the content inside the <div>.
Regards,
Radu
I'm not sure how you select the paragraphs, do you select them one by one by using the mouse? I'm selecting them by using shift with arrows starting before the first one and ending after the last one and things seem to work for me:
- Screenshot 2024-07-11 at 13.19.59.png (38.33 KiB) Viewed 1740 times
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 7
- Joined: Thu Feb 22, 2024 2:03 pm
Re: wrap multiple <p> tags for conditional processing
Post by petrepavlov »
Hi Radu,
Actually inserting <div> in Author mode does not work at all. I tried in several files and in a dummy file with the same result.
In the dummy file screenshot I try to insert <div> between the last two <p> elements.
In Text mode I can place a <div>, move the paragraphs, and print the pdf successfully.
Is there any option which could potentially block the insertion in Author mode?
Regards,
Petre
Actually inserting <div> in Author mode does not work at all. I tried in several files and in a dummy file with the same result.
In the dummy file screenshot I try to insert <div> between the last two <p> elements.
In Text mode I can place a <div>, move the paragraphs, and print the pdf successfully.
Is there any option which could potentially block the insertion in Author mode?
Regards,
Petre
- image.png (38.59 KiB) Viewed 1640 times
Re: wrap multiple <p> tags for conditional processing
Hi Petre,
Is it possible that you have installed in Oxygen a DITA framework customization created by you or by someone in your company which changes the list of allowed elements in the Oxygen content completion window?
This kind of customization is usually done with an XML configuration file:
https://www.oxygenxml.com/doc/versions/ ... t-elements
Because this would explain why the DITA topic is shown as valid when the <div> is inserted manually in the Text editing mode but you are not allowed to insert it in the content completion window.
Regards,
Radu
Is it possible that you have installed in Oxygen a DITA framework customization created by you or by someone in your company which changes the list of allowed elements in the Oxygen content completion window?
This kind of customization is usually done with an XML configuration file:
https://www.oxygenxml.com/doc/versions/ ... t-elements
Because this would explain why the DITA topic is shown as valid when the <div> is inserted manually in the Text editing mode but you are not allowed to insert it in the content completion window.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
Return to “DITA (Editing and Publishing DITA Content)”
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