CSS Content through StylesFilter
Having trouble installing Oxygen? Got a bug to report? Post it all here.
-
- Posts: 35
- Joined: Fri Nov 11, 2011 10:34 am
CSS Content through StylesFilter
Post by maxim.kovalev »
At opening of file OxygenAutor uses following css for loading of pictures
It is necessary for me that css changed in a program operating time, therefore I have redefined StyleFilter and have connected it through Extensions
This filter is started, but replacement doesn't help. I can I specify incorrect parameter?
Thanks.
Code: Select all
img {
...
content: url("http://localhost:8888/images/", attr(src));
...
}
Code: Select all
public class DITAStylesFilter implements StylesFilter {
private static final String IMAGE_TAG = "img";
@Override
public Styles filter (Styles styles, AuthorNode authorNode) {
if (AuthorNode.NODE_TYPE_ELEMENT == authorNode.getType() && IMAGE_TAG.equals(authorNode.getName())) {
try {
styles.setProperty(
Styles.KEY_PLACEHOLDER_CONTENT, new URL("http://localhost:8888/images/image.png"));
} catch (MalformedURLException e) {
e.printStackTrace();
}
}
return styles;
}
}
Thanks.
-
- Posts: 515
- Joined: Wed May 20, 2009 2:40 pm
Re: CSS Content through StylesFilter
The Styles.KEY_PLACEHOLDER_CONTENT refers to the placeholder-content CSS property, that allows you to decide what content should be displayed in Author for an empty element.
If you want to control the content of the element you have to use Styles.KEY_MIXED_CONTENT property key:
Regards,
Mihaela
If you want to control the content of the element you have to use Styles.KEY_MIXED_CONTENT property key:
Code: Select all
public Styles filter (Styles styles, AuthorNode authorNode) {
if (AuthorNode.NODE_TYPE_ELEMENT == authorNode.getType() &&
IMAGE_TAG.equals(authorNode.getName())) {
styles.setProperty(Styles.KEY_MIXED_CONTENT, new StaticContent[] {
new URIContent("http://www.oxygenxml.com/img/", "logo_oxygen.png")
});
}
return styles;
}
Mihaela
Mihaela Calotescu
http://www.oxygenxml.com
http://www.oxygenxml.com
-
- Posts: 35
- Joined: Fri Nov 11, 2011 10:34 am
Re: CSS Content through StylesFilter
Post by maxim.kovalev »
Hi, Mihaela
Styles.KEY_MIXED_CONTENT I set for image tag, and all works.
What style should be set for the tag attributes conref?
If I do so, then get an error:
Unsupported image type for 'localhost:8888/images/concept_Topic.dita#Topic_reference_1_6/testID'
See the help documentation for workarounds.
localhost:8888/images/concept_Topic.dita#Topic_reference_1_6/testID
Styles.KEY_MIXED_CONTENT I set for image tag, and all works.
What style should be set for the tag attributes conref?
Code: Select all
public Styles filter (Styles styles, AuthorNode authorNode) {
if (AuthorNode.NODE_TYPE_ELEMENT == authorNode.getType()) {
if(((AuthorElement)authorNode).getAttribute("conref")!=null){
styles.setProperty(Styles.KEY_MIXED_CONTENT, new StaticContent[] {
new URIContent("http://localhost:8888/images/", "concept_Topic.dita#Topic_reference_1_6/testID")
});
}
}
return styles;
}
Unsupported image type for 'localhost:8888/images/concept_Topic.dita#Topic_reference_1_6/testID'
See the help documentation for workarounds.
localhost:8888/images/concept_Topic.dita#Topic_reference_1_6/testID
-
- Posts: 35
- Joined: Fri Nov 11, 2011 10:34 am
-
- Posts: 515
- Joined: Wed May 20, 2009 2:40 pm
Re: CSS Content through StylesFilter
Hi Maxim,
Changing or setting the content reference cannot be done from the StylesFilter.
What you have to do is to create a References Resolver extension that can resolves the content referred by the DITA conref attribute.
Here is our online documentation about Configuring a References Resolver:
http://www.oxygenxml.com/doc/ug-editor/ ... olver.html
To add the reference resolver extension to your document type you can modify the Extensions bundle or you can add an individual Reference resolver extension (see Document Type dialog->Extensions tab).
For your reference resolver you can start from our DITA implementation (ro.sync.ecss.extensions.dita.conref.DITAConRefResolver). You can find the source code in oxygenAuthorSDK.zip, samples/Oxygen Default Frameworks directory.
Please let me know if need more information.
Best Regards,
Mihaela
Changing or setting the content reference cannot be done from the StylesFilter.
What you have to do is to create a References Resolver extension that can resolves the content referred by the DITA conref attribute.
Here is our online documentation about Configuring a References Resolver:
http://www.oxygenxml.com/doc/ug-editor/ ... olver.html
To add the reference resolver extension to your document type you can modify the Extensions bundle or you can add an individual Reference resolver extension (see Document Type dialog->Extensions tab).
For your reference resolver you can start from our DITA implementation (ro.sync.ecss.extensions.dita.conref.DITAConRefResolver). You can find the source code in oxygenAuthorSDK.zip, samples/Oxygen Default Frameworks directory.
Please let me know if need more information.
Best Regards,
Mihaela
Mihaela Calotescu
http://www.oxygenxml.com
http://www.oxygenxml.com
-
- Posts: 35
- Joined: Fri Nov 11, 2011 10:34 am
Re: CSS Content through StylesFilter
Post by maxim.kovalev »
Thanks, Mihaela
to add your StylesFilter I frameworks.zip your applet to add the following line dita.framework
and that we should add to dita.framework, for my AuthorReferenceResolver?
I added
but it does not work
to add your StylesFilter I frameworks.zip your applet to add the following line dita.framework
Code: Select all
<field name="cssStylesFilterExtension">
<String> Ro.sync.ecss.extensions.api.DITAStylesFilter </ String>
</ field>
I added
Code: Select all
<field name="customReferencesResolver"> <String>ro.sync.ecss.extensions.api.DITAReferenceResolver</String>
</field>
-
- Posts: 515
- Joined: Wed May 20, 2009 2:40 pm
Re: CSS Content through StylesFilter
Hi Maxim,
ro.sync.ecss.extensions.api.DITAReferenceResolver is your Author refrence resolver implementation class?
Indeed, the Author reference resolver implementation class in stored in "customReferencesResolver" field in .frameworks file.
What do you mean by "it does not work"?
You could send us the error messages (if any) or applet console messages on our support email (support@oxygenxml.com). This could help us understand the source of your problem.
Regards,
Mihaela
ro.sync.ecss.extensions.api.DITAReferenceResolver is your Author refrence resolver implementation class?
Indeed, the Author reference resolver implementation class in stored in "customReferencesResolver" field in .frameworks file.
What do you mean by "it does not work"?
You could send us the error messages (if any) or applet console messages on our support email (support@oxygenxml.com). This could help us understand the source of your problem.
Regards,
Mihaela
Mihaela Calotescu
http://www.oxygenxml.com
http://www.oxygenxml.com
-
- Posts: 35
- Joined: Fri Nov 11, 2011 10:34 am
Re: CSS Content through StylesFilter
Post by maxim.kovalev »
Hi,
Yes, ro.sync.ecss.extensions.api.DITAReferenceResolver is my Author refrence resolver implementation class
"it does not work" - does not go not in one of the implementation methods
Yes, ro.sync.ecss.extensions.api.DITAReferenceResolver is my Author refrence resolver implementation class
"it does not work" - does not go not in one of the implementation methods
-
- Posts: 515
- Joined: Wed May 20, 2009 2:40 pm
Re: CSS Content through StylesFilter
Is the jar that includes the ro.sync.ecss.extensions.api.DITAReferenceResolver class in the classpath (check the field named "classpath" from dita.frameworks)?
Regards,
Mihaela
Regards,
Mihaela
Mihaela Calotescu
http://www.oxygenxml.com
http://www.oxygenxml.com
-
- Posts: 35
- Joined: Fri Nov 11, 2011 10:34 am
Re: CSS Content through StylesFilter
Post by maxim.kovalev »
I'm sorry, it was necessary to clear the cache
implemented everything on http://www.oxygenxml.com/doc/ug-editor/ ... olver.html
but it was an ode to the problem
in
came all the contents of the document "concept_Topic_reference_1.dita"
and not a single element "Topic_reference_1_6/testID"
implemented everything on http://www.oxygenxml.com/doc/ug-editor/ ... olver.html
but it was an ode to the problem
in
Code: Select all
<author conref="concept_Topic_reference_1.dita#Topic_reference_1_6/testID">Test</author>
and not a single element "Topic_reference_1_6/testID"
-
- Posts: 35
- Joined: Fri Nov 11, 2011 10:34 am
Re: CSS Content through StylesFilter
Post by maxim.kovalev »
figured out
used class of DITAXMLReaderWrapper
thanks
used class of DITAXMLReaderWrapper
thanks
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