draft watermark until approved?
Having trouble installing Oxygen PDF Chemistry? Got a bug to report? Post it all here.
-
- Posts: 156
- Joined: Sat Feb 26, 2005 12:09 am
- Location: USA
- Contact:
draft watermark until approved?
Post by shudson310 »
We followed the tutorial to create a draft watermark, but how can we conditionalize this so that the watermark is applied until bookmap/approved exists in the map?
Is there a way to conditionally apply an @page template?
For example, if we set a variable:
so that when it exists, there should be some text, and when not, the value is null.
How can we conditionally apply it?
Is there a way to conditionally apply an @page template?
For example, if we set a variable:
Code: Select all
draftStatus oxy_xpath("(//*[contains(@class, 'bookmap/approved')]/text())[1]");
How can we conditionally apply it?
Code: Select all
@page and string(draftStatus)==not(null) {
size: 8.268in 11in !important;
margin-top: .75in !important;
margin-bottom: 1in !important;
}
@page and string(draftStatus)==null {
size: 8.268in 11in !important;
margin-top: .75in !important;
margin-bottom: 1in !important;
background-image:url("../../images/draft-watermark.png");
background-position:center;
background-repeat:no-repeat;
}
Scott Hudson
Staff Content Engineer
Site: docs.servicenow.com
Staff Content Engineer
Site: docs.servicenow.com
-
- Posts: 156
- Joined: Sat Feb 26, 2005 12:09 am
- Location: USA
- Contact:
Re: draft watermark until approved?
Post by shudson310 »
I tried a different approach, but still not working:
I still get the draft watermark on every page, even when the approved element is in the bookmeta.
Code: Select all
body:not(*[class ~= "bookmap/approved"]) {
background-image:url("../../images/draft-watermark.png");
background-position:center;
background-repeat:no-repeat;
}
body:has(*[class ~= "bookmap/approved"]) {
}
Scott Hudson
Staff Content Engineer
Site: docs.servicenow.com
Staff Content Engineer
Site: docs.servicenow.com
-
- Posts: 501
- Joined: Mon Feb 03, 2003 10:56 am
Re: draft watermark until approved?
I think there is no such class on the body element.
You will need to use a more complex strategy. The approved element is located in the bookmeta/bookchangehistory element.
I would use something like this:
Use oxy_xpath every time you need to probe the value form other element than the one matched by the selector, and test the expression on the merged HTML file using the XPath builder.
Let us know if you need more information.
Many regards,
Dan
You will need to use a more complex strategy. The approved element is located in the bookmeta/bookchangehistory element.
Code: Select all
<bookmeta>
<author>Howe Tuduit</author>
<critdates>
<created date="1/1/2015"/>
<revised modified="3/4/2016"/>
<revised modified="3/5/2016"/>
</critdates>
<bookchangehistory>
<approved/>
</bookchangehistory>
Code: Select all
body {
background-image: url(oxy_xpath('if (//bookmeta/bookchangehistory/approved) then "" else "../../images/draft-watermark.png" '));
background-position:center;
background-repeat:no-repeat;
background-color:inherit; /* The ashes theme imposes white on the body, this will clear it.*/
}
Let us know if you need more information.
Many regards,
Dan
-
- Posts: 156
- Joined: Sat Feb 26, 2005 12:09 am
- Location: USA
- Contact:
Re: draft watermark until approved?
Post by shudson310 »
Worked like a charm. As always, you oXygen folks are the best!
Many thanks!
Many thanks!

Scott Hudson
Staff Content Engineer
Site: docs.servicenow.com
Staff Content Engineer
Site: docs.servicenow.com
-
- Posts: 156
- Joined: Sat Feb 26, 2005 12:09 am
- Location: USA
- Contact:
Re: draft watermark until approved?
Post by shudson310 »
OK, I also want to add text in the footer for the draft status. I declared the variable in the .root:
And in the page templates, I have:
It works for the DRAFT mode, but when "approved" none of the footer content displays!
What am I missing?
Code: Select all
draftStatus oxy_xpath('if (//*[contains(@class, 'bookmap/permissions')]) then "" else "DRAFT" ')
Code: Select all
content : string(prodname) " " string(prodversion) "."
string(prodrelease) "."
string(prodmod) " " string(category) " " string(draftStatus) "\a" counter(page) !important;
What am I missing?
Scott Hudson
Staff Content Engineer
Site: docs.servicenow.com
Staff Content Engineer
Site: docs.servicenow.com
-
- Posts: 156
- Joined: Sat Feb 26, 2005 12:09 am
- Location: USA
- Contact:
Re: draft watermark until approved?
Post by shudson310 »
ugh. Copy/paste error. should be:
Still not working when "approved" though.
Code: Select all
draftStatus oxy_xpath('if (//*[contains(@class, 'bookmap/approved')]) then "" else "DRAFT" ')
Scott Hudson
Staff Content Engineer
Site: docs.servicenow.com
Staff Content Engineer
Site: docs.servicenow.com
-
- Posts: 156
- Joined: Sat Feb 26, 2005 12:09 am
- Location: USA
- Contact:
Re: draft watermark until approved?
Post by shudson310 »
Turns out it was a quote nesting issue. This fixed it:
Code: Select all
draftStatus oxy_xpath('if (//*[contains(@class, "bookmap/approved")]) then "" else "DRAFT" ');
Scott Hudson
Staff Content Engineer
Site: docs.servicenow.com
Staff Content Engineer
Site: docs.servicenow.com
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