Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make navtitle element from topictitle #4

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<refactoringOperationDescriptor
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.oxygenxml.com/ns/xmlRefactoring" id="set_navtitle_topic_title" name="Set navtitle element from topic title">
<description>Set navtitle element from topic title.</description>
<script type="XSLT" href="SetnavtitleFromTopicTitle.xsl"/>
<category>Flow</category>
</refactoringOperationDescriptor>
85 changes: 85 additions & 0 deletions 28.1 Make navtitle from topictitle/SetnavtitleFromTopicTitle.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xd="http://www.oxygenxml.com/ns/doc/xsl" exclude-result-prefixes="xs xd" version="2.0">

<xsl:output indent="yes" omit-xml-declaration="yes"/>
<xsl:strip-space elements="*"/>

<xsl:template match="node() | @*">
<xsl:copy>
<xsl:apply-templates select="node() | @*"/>
</xsl:copy>
</xsl:template>

<xd:doc>
<xd:desc>Get the topic title and add it as a <navtitle/> element (nested in <topicmeta/>) to the <topicref/> element.</xd:desc>
</xd:doc>

<xsl:template match="topicref[@href]">
<xsl:copy>
<xsl:apply-templates select="@* except @navtitle"/>
<xsl:if test="count(topicmeta) = 0">
<topicmeta>
<navtitle>
<xsl:message>test</xsl:message>
<xsl:value-of select="document(@href)/topic[@audience]"/>
</navtitle>
</topicmeta>
</xsl:if>
<xsl:apply-templates select="*"/>
</xsl:copy>
</xsl:template>

<xd:doc>
<xd:desc>Get the topic title and add it as a <navtitle/> element (nested in <topicmeta/>) to the <chapter/> element.</xd:desc>
</xd:doc>

<xsl:template match="chapter[@href]">
<xsl:copy>
<xsl:apply-templates select="@* except @navtitle"/>
<xsl:if test="count(topicmeta) = 0">
<topicmeta>
<navtitle>
<xsl:message>test</xsl:message>
<xsl:value-of select="document(@href)/topic[@audience]"/>
</navtitle>
</topicmeta>
</xsl:if>
<xsl:apply-templates select="*"/>
</xsl:copy>
</xsl:template>


<xd:doc>
<xd:desc>Update the existing <navtitle/> element on topicref.</xd:desc>
</xd:doc>

<xsl:template match="topicmeta[parent::*[1][self::topicref]]">
<xsl:copy>
<xsl:apply-templates select="@*"/>
<xsl:apply-templates select="* except navtitle"/>

<navtitle>
<xsl:message>test</xsl:message>
<xsl:value-of select="parent::topicref/document(@href)/*/@audience"/>
</navtitle>

</xsl:copy>
</xsl:template>

<xd:doc>
<xd:desc>Update the existing <navtitle/> element on chapter.</xd:desc>
</xd:doc>

<xsl:template match="topicmeta[parent::*[1][self::chapter]]">
<xsl:copy>
<xsl:apply-templates select="@*"/>
<xsl:apply-templates select="* except navtitle"/>

<navtitle>
<xsl:message>test</xsl:message>
<xsl:value-of select="parent::chapter/document(@href)/topic[@audience]"/>
</navtitle>
</xsl:copy>
</xsl:template>

</xsl:stylesheet>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<refactoringOperationDescriptor
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.oxygenxml.com/ns/xmlRefactoring" id="set_navtitle_element_topic_title" name="Set navtitle element from topic title for topicref and chapter elements.">
<description>Set navtitle element from topic title for topicref and chapter elements.</description>
<script type="XSLT" href="SetnavtitleFromTopicTitle.xsl"/>
</refactoringOperationDescriptor>
80 changes: 80 additions & 0 deletions 28.1 Set navtitle from topictitle/SetnavtitleFromTopicTitle.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xd="http://www.oxygenxml.com/ns/doc/xsl" exclude-result-prefixes="xs xd" version="2.0">

<xsl:output indent="yes" omit-xml-declaration="yes"/>
<xsl:strip-space elements="*"/>

<xsl:template match="node() | @*">
<xsl:copy>
<xsl:apply-templates select="node() | @*"/>
</xsl:copy>
</xsl:template>

<xd:doc>
<xd:desc>Get the topic title from @href and add it as a <navtitle/> element (nested in <topicmeta/>) to the <topicref/> element.</xd:desc>
</xd:doc>

<xsl:template match="topicref[@href]">
<xsl:copy>
<xsl:apply-templates select="@* except @navtitle"/>
<xsl:if test="count(topicmeta) = 0">
<topicmeta>
<navtitle>
<xsl:value-of select="document(@href)/*/title"/>
</navtitle>
</topicmeta>
</xsl:if>
<xsl:apply-templates select="*"/>
</xsl:copy>
</xsl:template>

<xd:doc>
<xd:desc>Get the topic title from @href and add it as a <navtitle/> element (nested in <topicmeta/>) to the <chapter/> element.</xd:desc>
</xd:doc>

<xsl:template match="chapter[@href]">
<xsl:copy>
<xsl:apply-templates select="@* except @navtitle"/>
<xsl:if test="count(topicmeta) = 0">
<topicmeta>
<navtitle>
<xsl:value-of select="document(@href)/*/title"/>
</navtitle>
</topicmeta>
</xsl:if>
<xsl:apply-templates select="*"/>
</xsl:copy>
</xsl:template>



<xd:doc>
<xd:desc>Update the existing <navtitle/> element on topicref.</xd:desc>
</xd:doc>

<xsl:template match="topicmeta[parent::*[1][self::topicref]]">
<xsl:copy>
<xsl:apply-templates select="@*"/>
<xsl:apply-templates select="* except navtitle"/>
<navtitle>
<xsl:value-of select="parent::topicref/document(@href)/*/title"/>
</navtitle>
</xsl:copy>
</xsl:template>

<xd:doc>
<xd:desc>Update the existing <navtitle/> element on chapter.</xd:desc>
</xd:doc>

<xsl:template match="topicmeta[parent::*[1][self::chapter]]">
<xsl:copy>
<xsl:apply-templates select="@*"/>
<xsl:apply-templates select="* except navtitle"/>
<navtitle>
<xsl:value-of select="parent::chapter/document(@href)/*/title"/>
</navtitle>
</xsl:copy>
</xsl:template>


</xsl:stylesheet>