Displaying empty elements (or not)

Hi folks, oXygen supports the CSS3 selector :empty, so (for example) we can hide an element that has no content styled, in the Author View, for "preview", while showing it in an editing style. This is useful when, for example, editing documents whose schemas require elements in places where the user has no content for them. So if we have <sect><head/><p>Headless section</p></sect> we don't have to see anything where the empty 'head' element is, at least when oXygen Author is set to "No Tags". Unfortunately, however, since CSS isn't XPath, there's no way to suppress the 'sect' element, when we have <sect><head/></sect> (We can make the 'head' disappear but then we see a placeholder for the 'sect'.) I know the correct solution is not to deploy schemas that require elements that are not always used. But I wonder if anyone has a CSS workaround or an oXygen extension to suggest so that my oXygen XML Author preview can show something more like what the document will look like when it is formatted and the offending elements are dropped. Any ideas? Thanks, Wendell Wendell Piez | http://www.wendellpiez.com XML | XSLT | electronic publishing Eat Your Vegetables _____oo_________o_o___ooooo____ooooooo_^

Hi Wendell, I assume that you're hiding the empty head element by sect > head:empty { display: none; } If you use sect > head:empty { content: ""; } instead, you should get the desired behavior: No placeholder is displayed - neither for head nor for sect. (Still you're able to move the cursor to any position inside to add content.) The reason for this lies in the default logic of the placeholders to be displayed: When there is no content to be displayed and explicitly content assigned (directly or to :before or :after) it is hidden. Since there is no value "none" for -oxy-show-placeholder you can hide it by assigning empty content. BTW: Why do you want to allow sections without heading? I recently changed our schema to forbid this since <sect> <head>Heading</head> <p>some text</p> </sect> <sect> <head/> <p>some more text</p> </sect> looks in the output identical to <sect> <head>Heading</head> <p>some text</p> <p>some more text</p> </sect> Regards, Patrik ------------------------------------------------------------------ Systemarchitektur & IT-Projekte Tel: +49 40 33449-1142 Fax: +49 40 33449-1400 E-Mail: patrik.stellmann@gdv-dl.de Von: Wendell Piez <wapiez@wendellpiez.com> An: "oxygen-user@oxygenxml.com" <oxygen-user@oxygenxml.com> Datum: 06.11.2013 20:55 Betreff: [oXygen-user] Displaying empty elements (or not) Gesendet von: oxygen-user-bounces@oxygenxml.com Hi folks, oXygen supports the CSS3 selector :empty, so (for example) we can hide an element that has no content styled, in the Author View, for "preview", while showing it in an editing style. This is useful when, for example, editing documents whose schemas require elements in places where the user has no content for them. So if we have <sect><head/><p>Headless section</p></sect> we don't have to see anything where the empty 'head' element is, at least when oXygen Author is set to "No Tags". Unfortunately, however, since CSS isn't XPath, there's no way to suppress the 'sect' element, when we have <sect><head/></sect> (We can make the 'head' disappear but then we see a placeholder for the 'sect'.) I know the correct solution is not to deploy schemas that require elements that are not always used. But I wonder if anyone has a CSS workaround or an oXygen extension to suggest so that my oXygen XML Author preview can show something more like what the document will look like when it is formatted and the offending elements are dropped. Any ideas? Thanks, Wendell Wendell Piez | http://www.wendellpiez.com XML | XSLT | electronic publishing Eat Your Vegetables _____oo_________o_o___ooooo____ooooooo_^ _______________________________________________ oXygen-user mailing list oXygen-user@oxygenxml.com http://www.oxygenxml.com/mailman/listinfo/oxygen-user GDV Dienstleistungs-GmbH & Co. KG Glockengießerwall 1 D-20095 Hamburg www.gdv-dl.de Sitz und Registergericht: Hamburg HRA 93 894 USt.-IdNr : DE 205183123 Komplementärin: GDV Beteiligungsgesellschaft mbH Sitz und Registergericht: Hamburg HRB 71 153 Geschäftsführer: Volker Sonnenburg Heiko Beermann ------------------------------------------------------------------ Diese E-Mail und alle Anhänge enthalten vertrauliche und/oder rechtlich geschützte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese E-Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe der E-Mail ist nicht gestattet. This e-mail and any attached files may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorised copying, disclosure or distributionof the material in this e-mail is strictly forbidden.

Dear Patrick, Thanks! I will try this. I was hoping someone had something like this in their pocket. You ask why I want to permit sections with no heading. Actually, I don't -- the example I offered was only a mockup. The real problem is one where a semantic element such as (say) an 'introduction' is required by the schema but not always wanted by the users. So we have something like (RNC syntax): element doc { head, element introduction { p+ }, section+ } In order to construct valid documents, users have to insert <introduction><p></p></introduction> even when they have nothing to put in it. Now (you ask) why is 'introduction' required if documents don't always have them? It's the same question I am asking the people in charge. It could be bad modeling (which sometimes reflects power struggles, and sometimes it's just bad). Or there could be a workflow thing (maybe the introductions are written by someone else later). Or a combination (maybe they need two schemas for their actual workflow, or a looser schema along with a tighter Schematron?). As a humble counselor to the king, all I can do is offer my best advice along with my services ... and they want a "clean" preview. Cheers, Wendell Wendell Piez | http://www.wendellpiez.com XML | XSLT | electronic publishing Eat Your Vegetables _____oo_________o_o___ooooo____ooooooo_^ On Thu, Nov 7, 2013 at 1:08 AM, <Patrik.Stellmann@gdv-dl.de> wrote:
Hi Wendell,
I assume that you're hiding the empty head element by sect > head:empty { display: none; }
If you use sect > head:empty { content: ""; } instead, you should get the desired behavior: No placeholder is displayed - neither for head nor for sect. (Still you're able to move the cursor to any position inside to add content.) The reason for this lies in the default logic of the placeholders to be displayed: When there is no content to be displayed and explicitly content assigned (directly or to :before or :after) it is hidden. Since there is no value "none" for -oxy-show-placeholder you can hide it by assigning empty content.
BTW: Why do you want to allow sections without heading? I recently changed our schema to forbid this since <sect> <head>Heading</head> <p>some text</p> </sect> <sect> <head/> <p>some more text</p> </sect> looks in the output identical to <sect> <head>Heading</head> <p>some text</p> <p>some more text</p> </sect>
Regards,
Patrik
------------------------------------------------------------------ Systemarchitektur & IT-Projekte Tel: +49 40 33449-1142 Fax: +49 40 33449-1400 E-Mail: patrik.stellmann@gdv-dl.de
Von: Wendell Piez <wapiez@wendellpiez.com> An: "oxygen-user@oxygenxml.com" <oxygen-user@oxygenxml.com> Datum: 06.11.2013 20:55 Betreff: [oXygen-user] Displaying empty elements (or not) Gesendet von: oxygen-user-bounces@oxygenxml.com ________________________________
Hi folks,
oXygen supports the CSS3 selector :empty, so (for example) we can hide an element that has no content styled, in the Author View, for "preview", while showing it in an editing style.
This is useful when, for example, editing documents whose schemas require elements in places where the user has no content for them. So if we have
<sect><head/><p>Headless section</p></sect>
we don't have to see anything where the empty 'head' element is, at least when oXygen Author is set to "No Tags".
Unfortunately, however, since CSS isn't XPath, there's no way to suppress the 'sect' element, when we have
<sect><head/></sect>
(We can make the 'head' disappear but then we see a placeholder for the 'sect'.)
I know the correct solution is not to deploy schemas that require elements that are not always used. But I wonder if anyone has a CSS workaround or an oXygen extension to suggest so that my oXygen XML Author preview can show something more like what the document will look like when it is formatted and the offending elements are dropped.
Any ideas?
Thanks, Wendell
Wendell Piez | http://www.wendellpiez.com
XML | XSLT | electronic publishing Eat Your Vegetables _____oo_________o_o___ooooo____ooooooo_^ _______________________________________________ oXygen-user mailing list oXygen-user@oxygenxml.com http://www.oxygenxml.com/mailman/listinfo/oxygen-user
GDV Dienstleistungs-GmbH & Co. KG Glockengießerwall 1 D-20095 Hamburg www.gdv-dl.de
Sitz und Registergericht: Hamburg HRA 93 894 USt.-IdNr : DE 205183123
Komplementärin: GDV Beteiligungsgesellschaft mbH Sitz und Registergericht: Hamburg HRB 71 153
Geschäftsführer: Volker Sonnenburg Heiko Beermann
------------------------------------------------------------------ Diese E-Mail und alle Anhänge enthalten vertrauliche und/oder rechtlich geschützte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese E-Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe der E-Mail ist nicht gestattet.
This e-mail and any attached files may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorised copying, disclosure or distributionof the material in this e-mail is strictly forbidden.
_______________________________________________ oXygen-user mailing list oXygen-user@oxygenxml.com http://www.oxygenxml.com/mailman/listinfo/oxygen-user
participants (2)
-
Patrik.Stellmann@gdv-dl.de
-
Wendell Piez