I want to update topicref element values dynamically before DITA OT preprocessing starts.
I have created an xsl file with a template which match the ditamap element and update the node values. That xsl file I have added in a target and that target I have added in the preprocessing target(<target name="preprocess" depends="preprocess.init,updatemap,.../>). But this did not help me to update the map.
Please guide me the steps which I need to follow to update the map.
DIT OT version 3.7.1
plugin xhtml
Related
I'm currently building an XSLT stylesheet used to document other XSLT stylesheets in a series of folders and sub-folders. My code pulls out specific details about variables, functions, etc and renders it in an output format. The sheets being read are created by a 3rd party product. Most of them have an XSL extension but some of them are proprietary extensions. I have some files with a DTCBS extension but they are just XSL stylesheets.
I'm currently loading the content of these files into a variable using the XSLT function "collection" as follows:
<xsl:variable name="Collection" select="collection(concat('file:///', encode-for-uri(replace($filePath, '\\', '/')),'?select=*.(xsl|dtcbs|xml);recurse=yes'))" as="node()*"/>
The variable works just fine if I use XSL|XML. But if I include the DTCBS extension, the variable blows up citing "the supplied value is xs:base64Binary".
If I manually put the xml declaration line at the top of my DTCBS file, the variable works fine. Those DTCBS files are auto-generated without the declaration line so I can't fix that, nor can I manually edit them each time I want to run my documenter code.
From what I can tell, because it's not an XSL extension, and the XML declaration line isn't present, the XSLT parser thinks it's base64 when it isn't.
I'm using Saxon as my XSLT parser and the Saxon documentation says it uses file extensions and http headers to detect the file type.
Does anyone know if there is a way to force collection() to treat every file as an XSL?
Tried adding the XML declaration line in the DTCBS file. This did correct the issue but I can't do this in all cases as I am trying to automate the entire thing.
I also renamed the DTCBS extension to XSL and the problem went away as well.
As well as Martin's suggestion, you can register content types with the Saxon configuration:
processor.getUnderlyingConfiguration()
.registerFileExtension("dtcbs", "application/xml");
This has been available since Saxon 9.7.
Try to add e.g. content-type=application/xml e.g. '?select=*.(xsl|dtcbs|xml);recurse=yes;content-type=application/xml'.
I have a topic, which only contains some metadata (childs of prolog and some custom elements too) of the documentation. The contents of these elements is displayed in headers and footers in the acutal PDF output.
My problem: now the referred topic itself included in the pdf as an empty chapter.
Setting the processing-role to resource-only or filtering the topic does not solve the problem, as the content of the elements is needed in the further steps of the transformation (headers, footerst ect..)
My best guess is to somehow exclude this one topic and the needless page sequence based on its ID with..
.. adding some attributes in a custom xsl template?
.. modification of topic processing?
.. an obvious method that didn’t occur to me?
but I’m a beginner, so a little guidance would be nice.
Currently using:
DITA-OT 2.1; Oxygen 17.1; Bookmap spec.; XSL FO based transformations;
Thanks in advance!
Maybe instead of keeping that content inside the topic, you could keep it inside the main DITA Map, maybe using some DITA "data" elements like:
<map>
<title></title>
<topicmeta>
<data name="d1" value="v1"/>
</topicmeta>
Anyway if you plan to continue with having a separate topic, maybe you can set on that topic an "outputclass='filtered'" attribute and then use Oxygen's Find/Replace in Files to search in the folder "DITA-OT/plugins/org.dita.pdf2" for "bookmap/chapter". You probably need to find the XSLT templates which process DITA "chapter" elements for the table of contents, bookmarks area and for the main document and add a [not(#outputclass='hidden')] condition to them so that they skip that topic.
I just wanted to generate a documentation of a schema with xs3p.
The problem is, as far as I understand it, that the schema is split into several files and that xs3p did not process the include-tags of the master file: The result is a documentation containing only the root element.
What did I do exactly?
I unzipped the xs3p-download into a certain directory
I copied all schema files into the directory
I called saxonb-xslt master.xsd xs3p.xsl >doku.html (under Ubuntu Trusty, if that matters)
Can you give me any help? I assume, there are two lines to solve the problem:
Making xs3p process the include-tags
Integrating all xsd-files into a single one — how would this work?
Thank you in advance!
You have to set the following xsl:param in xs3p.xsl :
<!-- If 'true', searches 'included' schemas for schema components
when generating links and XML Instance Representation tables. -->
<xsl:param name="searchIncludedSchemas">true</xsl:param>
<!-- If 'true', searches 'imported' schemas for schema components
when generating links and XML Instance Representation tables. -->
<xsl:param name="searchImportedSchemas">true</xsl:param>
<!-- File containing the mapping from file locations of external
(e.g. included, imported, refined) schemas to file locations
of their XHTML documentation. -->
<xsl:param name="linksFile">xs3p_links.xml</xsl:param>
Your included/imported schemas must have been previously transformed into a my_transformed_included_schema.html file, and you need to define a xs3p_links.xml file in order to assign some imported/included schema to theirs location such as :
<?xml version="1.0"?>
<links xmlns="http://titanium.dstc.edu.au/xml/xs3p">
<schema file-location="my-included-schema.xsd" docfile-location="./my_transformed_included_schema.html"/>
</links>
Hope that'll help !
I'm having some trouble loading the document (see link http://pastebin.com/FE3nDX9h) in pugixml.
I'm getting an error code of 16: No document element found which indicates that the XML file is invalid or empty which I think is neither.
I am using the default parsing method. Is there something I am missing?
edit: as requested heres some source code http://pastebin.com/USUjLC4q you will need to edit the paths.
You need xml_document::load_file but xml_document::load.
From pugi documentation:
There is also a simple helper function, xml_document::load, for cases when you want to load the XML document from null-terminated character string.
So, load's argument has to be xml by itself, not file name.
I have a scenario here I have multiple xsl designed for different type of XML files. Now I have some application ID that is passed to my XSL library with now I want to load different xsl based on this application ID values.
Like if my application ID is 1
if application ID is 2
how can I do this???
Please help
In XSLT, xsl:include and xsl:import must be top-level elements, as said in the specifications (here for version 1.0).
That means that you can not condition the loading of another XSL file based on the XML you are applying the XSL to.