forked from oxygenxml/userguide
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0f0e609
commit 0a304bb
Showing
1 changed file
with
64 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd"> | ||
<topic id="topic_qfl_l5z_1x"> | ||
<title>Converting Subject Scheme Map Values to a DITAVAL</title> | ||
<body> | ||
<p>Let's say you already have a Subject Scheme Map in your project and you use it to control | ||
attribute values: <xref | ||
href="http://blog.oxygenxml.com/2015/07/controlled-attribute-values-for-your.html" | ||
format="html"/>. </p> | ||
<p>In the Oxygen <b>Colors and Styles</b> Preferences page you can also assign various colors | ||
and styles to each profiling attribute (name, value) combination. One option for this is to | ||
manually re-add attributes and values in that list. Another option would be to create an XSLT | ||
stylesheet to gather all profiling attribute names and values from the Subject Scheme map and | ||
create a <b>DITAVAL</b> file. The stylesheet would look like this:</p> | ||
<codeblock outputclass="language-xml"><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | ||
xmlns:xs="http://www.w3.org/2001/XMLSchema" | ||
exclude-result-prefixes="xs" | ||
version="2.0"> | ||
<xsl:output indent="yes"/> | ||
<xsl:template match="/"> | ||
<val> | ||
<xsl:for-each select="subjectScheme/enumerationdef"> | ||
<!-- For each attribute name --> | ||
<xsl:if test="subjectdef/@keyref and attributedef/@name"> | ||
<xsl:variable name="attrName" select="attributedef/@name"/> | ||
<xsl:variable name="keyref" select="subjectdef/@keyref"/> | ||
<!-- For each key value --> | ||
<xsl:for-each select="//*[@keys=$keyref]/*//@keys"> | ||
<xsl:variable name="attributeValue" select="."/> | ||
<prop action="flag" att="{$attrName}" val="{$attributeValue}"/> | ||
</xsl:for-each> | ||
</xsl:if> | ||
</xsl:for-each> | ||
</val> | ||
</xsl:template> | ||
</xsl:stylesheet></codeblock> | ||
<p>After you obtain the <b>DITAVAL</b>, you can import it directly in the <b>Colors and | ||
Styles</b> preferences page. If the <b>DITAVAL</b> file has flagging information, that | ||
information will be directly used to style each attribute value.</p> | ||
<p>A possibility to enhance this workaround is to specify profiling styles for each attribute | ||
value directly in the Subject Scheme map using the <xmlelement>data</xmlelement> element | ||
like:<codeblock outputclass="language-xml"><subjectdef keys="linux"> | ||
<data name="color" value="yellow"/> | ||
</subjectdef></codeblock></p> | ||
<p>in which case the <b>XSLT</b> stylesheet would create the <b>DITAVAL</b> by picking colors | ||
directly from the <b>Subject Scheme | ||
Map</b>:<codeblock outputclass="language-xml">….….….... | ||
<prop action="flag" att="{$attrName}" val="{$attributeValue}"> | ||
<xsl:choose> | ||
<!-- Here you can also set flagging colors depending on the profiling attribute value --> | ||
<xsl:when test="data[@name='color']"> | ||
<xsl:attribute name="color" select="data/@value"/> | ||
</xsl:when> | ||
</xsl:choose> | ||
</prop> | ||
….….….….</codeblock>In | ||
this way your <b>Subject Scheme Map</b> will keep both the controlled attribute values and | ||
various colors and styles which can later be used to create a <b>DITAVAL</b> and either | ||
publish with those styles or import the <b>DITAVAL</b> in Oxygen in order to highilight | ||
various elements with various colors:<xref | ||
href="https://www.oxygenxml.com/demo/Colors_and_Styles_for_Profiled_Content.html" | ||
format="html"/>.</p> | ||
</body> | ||
</topic> |