Tracing templates in front-matter.xsl for PDF2
Here should go questions about transforming XML with XSLT and FOP.
-
- Posts: 58
- Joined: Fri Sep 12, 2008 12:12 am
Tracing templates in front-matter.xsl for PDF2
This is just a curiosity for me, but I wanted to know where the templates are that finally pull the values for what is in author tags, and copyright tags, etc for ditamap metadata in the <DITA-OT>\demo\fo\xsl\fo\front-matter.xsl file? Under the code to generate the title and subtitle there is a match for topicmeta tags which I traced to another template below that that says <xsl:template match="*[contains(@class, ' map/topicmeta ')]"> but then inside just says "<xsl:apply-templates/>" instead of an <xsl:value-of> assignment like I would expect. All the other similar templates do the same. Where are the final templates that extract the values from the tags?
In the "createFrontMatter" template there, for example, is an explicit call to a template (<xsl:call-template name="insertFrontMatterStaticContents"/>)that I traced to commons.xsl but after looking in commons and other .xsl files in the directory I cannot similarly figure out which templates the author, copyright, etc. tags are gotten from.
Any ideas about how to trace this?
In the "createFrontMatter" template there, for example, is an explicit call to a template (<xsl:call-template name="insertFrontMatterStaticContents"/>)that I traced to commons.xsl but after looking in commons and other .xsl files in the directory I cannot similarly figure out which templates the author, copyright, etc. tags are gotten from.
Any ideas about how to trace this?
-
- Posts: 9439
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Tracing templates in front-matter.xsl for PDF2
Hello Josh,
I searched for topic/author which is the class value for the <author> tag in all the stylesheets from the OXYGEN_INSTALL_DIR\dita\DITA-OT\demo\fo\xsl\fo directory using the Oxygen Find/Replace in Files.
In the OXYGEN_INSTALL_DIR\dita\DITA-OT\demo\fo\xsl\fo\front-matter.xsl at line 104 you have the template which mathes the author tag:
The <xsl:apply-templates/> means that all other templates which can match the contents of the <author> tag will be applied.
This usually means that the text of the author will be output there.
The attribute-set used by the author xsl:use-attribute-sets="author" can be found defined in OXYGEN_INSTALL_DIRdita\DITA-OT\demo\fo\cfg\fo\attrs\commons-attr.xsl
Regards,
Radu
I searched for topic/author which is the class value for the <author> tag in all the stylesheets from the OXYGEN_INSTALL_DIR\dita\DITA-OT\demo\fo\xsl\fo directory using the Oxygen Find/Replace in Files.
In the OXYGEN_INSTALL_DIR\dita\DITA-OT\demo\fo\xsl\fo\front-matter.xsl at line 104 you have the template which mathes the author tag:
Code: Select all
<xsl:template match="*[contains(@class, ' topic/author ')]">
<fo:block xsl:use-attribute-sets="author" >
<xsl:apply-templates/>
</fo:block>
</xsl:template>
This usually means that the text of the author will be output there.
The attribute-set used by the author xsl:use-attribute-sets="author" can be found defined in OXYGEN_INSTALL_DIRdita\DITA-OT\demo\fo\cfg\fo\attrs\commons-attr.xsl
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 58
- Joined: Fri Sep 12, 2008 12:12 am
Re: Tracing templates in front-matter.xsl for PDF2
Hello Radu,
In <DITA-OT>\demo\fo\cfg\fo\commons.xsl on lines 712-718 it has a stub template, which does nothing at the moment because its contents are commented out, but which matches the author tag:
However I have seen no other templates to match topic/author that actually do something with the tag. Establishing a block with attribute sets is not enough to pull the value from the author context nodes is it? For that I should expect an <xsl:value-of> or some equivalent statement to extract the value, right? Do you see what I am asking?
That's alright if you don't know, but I just wanted to see if anyone had an explanation.
Regards,
Josh
Yes that was the template I was referring to. Thank you for making that more specific.Radu wrote:I searched for topic/author which is the class value for the <author> tag in all the stylesheets from the OXYGEN_INSTALL_DIR\dita\DITA-OT\demo\fo\xsl\fo directory using the Oxygen Find/Replace in Files.
In the OXYGEN_INSTALL_DIR\dita\DITA-OT\demo\fo\xsl\fo\front-matter.xsl at line 104 you have the template which mathes the author tag:
Well I understand it is calling any other templates that will match for that context node (the <author> tag in this case), however I have not been able to find any other templates that match it in the xsl files, and other related templates just have more <xsl:apply-templates/> statements, it seems, recursively - like the map/topicmeta template applying templates which will eventually call the topic/author template if there are any <author> tags, which in turn applies more templates which I have not been able to further trace. But I still do not see which template applies/extracts the text inside the author tag.The <xsl:apply-templates/> means that all other templates which can match the contents of the <author> tag will be applied.
This usually means that the text of the author will be output there.
In <DITA-OT>\demo\fo\cfg\fo\commons.xsl on lines 712-718 it has a stub template, which does nothing at the moment because its contents are commented out, but which matches the author tag:
Code: Select all
<xsl:template match="*[contains(@class, ' topic/author ')]">
<!--
<fo:block xsl:use-attribute-sets="author">
<xsl:apply-templates/>
</fo:block>
-->
</xsl:template>
That's alright if you don't know, but I just wanted to see if anyone had an explanation.
Right, I have looked at the attribute xsl files associated with various templates used in front-matter.xslThe attribute-set used by the author xsl:use-attribute-sets="author" can be found defined in OXYGEN_INSTALL_DIRdita\DITA-OT\demo\fo\cfg\fo\attrs\commons-attr.xsl
Regards,
Josh
-
- Posts: 9439
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Tracing templates in front-matter.xsl for PDF2
Hi Josh,
If a stylesheet does not match text() nodes explicitly in a template there are default rules which apply and make the entire text be output by default.
See this link for more details:
http://www.w3.org/TR/xslt#built-in-rule
For example this stylesheet:
will output all text nodes even if there is no specific template matching text().
You can overwrite the default template which matches text nodes like:
Regards,
Radu
If a stylesheet does not match text() nodes explicitly in a template there are default rules which apply and make the entire text be output by default.
See this link for more details:
http://www.w3.org/TR/xslt#built-in-rule
For example this stylesheet:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="/">
<xsl:apply-templates/>
</xsl:template>
</xsl:stylesheet>
You can overwrite the default template which matches text nodes like:
Code: Select all
<xsl:template match="text()|@*">
<xsl:value-of select="."/>
</xsl:template>
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.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