Skip to content

Commit

Permalink
Split works!
Browse files Browse the repository at this point in the history
  • Loading branch information
joshualubell committed Nov 6, 2019
1 parent 5ba099f commit 0a53a79
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 21 deletions.
2 changes: 1 addition & 1 deletion dita/plugins/gov.nist.scap.datastream/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<?xml-model href="dita-ot/plugin.rnc" type="application/relax-ng-compact-syntax"?>
<plugin id="gov.nist.scap.datastream">
<require plugin="gov.nist.scap.doctypes"/>
<transtype name="sds" desc="SCAP Data Stream Collection">
<transtype name="sds" desc="compose SCAP Data Stream Collection from component files">
<param name="sds.scapval"
desc="URI of NIST SCAP Content Validation Tool jar file"
type="file"/>
Expand Down
4 changes: 2 additions & 2 deletions dita/plugins/gov.nist.scap.datastream/sdsbuild.xml
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,14 @@
<xmlcatalog refid="dita.catalog"/>
</xslt>
</pipeline>
<pipeline message="Create DITA map referencing conversion output" taskname="xslt">
<pipeline message="Create DITA map referencing generated SCAP source data stream collection" taskname="xslt">
<xslt basedir="${dita.output.dir}"
destdir="${dita.output.dir}"
extension="ditamap"
style=
"${dita.plugin.gov.nist.scap.datastream.dir}${file.separator}xsl${file.separator}sdsditamap.xsl">
<ditafileset format="ditamap" processingRole="normal"/>
<mapper type="merge" to="ditamap-${sds.filename.root}.ditamap"/>
<mapper type="merge" to="composed-${sds.filename.root}.ditamap"/>
<param name="sdsuri" expression="${sds.filename.root}.${out.ext}"/>
<xmlcatalog refid="dita.catalog"/>
</xslt>
Expand Down
1 change: 0 additions & 1 deletion dita/plugins/gov.nist.scap.split/splitbuild.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
<xslt basedir="${dita.output.dir}"
destdir="${dita.output.dir}"
extension="${out.ext}"
filedirparameter="destdir"
style=
"${dita.plugin.gov.nist.scap.split.dir}${file.separator}xsl${file.separator}split.xsl">
<ditafileset format="ditamap" processingRole="normal"/>
Expand Down
35 changes: 18 additions & 17 deletions dita/plugins/gov.nist.scap.split/xsl/split.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,24 @@
version="2.0">

<xsl:output indent="yes" method="xml"/>
<xsl:param name="destdir"/>

<xsl:function name="nist:filename" as="xs:string">
<xsl:param name="compid" as="xs:string"/>
<xsl:variable name="href" select="fn:substring-after($compid, '_comp_')"/>
<xsl:choose>
<xsl:when test="fn:ends-with($href, '.xml')">
<xsl:sequence select="$href"/>
<xsl:value-of select="$href"/>
</xsl:when>
<xsl:otherwise>
<xsl:sequence select="fn:concat($href, '.xml')"/>
<xsl:value-of select="fn:concat($href, '.xml')"/>
</xsl:otherwise>
</xsl:choose>
</xsl:function>

<xsl:template match="/processing-instruction()"/>

<xsl:template match="*[contains(
@class,
' map/map ')]">
<xsl:message>Entering map</xsl:message>
<xsl:message>Matching DITA map</xsl:message>
<xsl:apply-templates select="*[contains(
@class,
' map/topicref ')]"/>
Expand All @@ -40,25 +37,29 @@
<xsl:template match="*[contains(
@class,
' map/topicref ')]">
<xsl:message>Entering topicref</xsl:message>
<xsl:message>Matching topicref</xsl:message>
<xsl:apply-templates select="document(@href)"/>
</xsl:template>

<xsl:template match="sds:data-stream-collection">
<xsl:message>Entering sds:data-stream-collection</xsl:message>
<xsl:message>
<xsl:text>Matching data stream collection id=</xsl:text>
<xsl:value-of select="@id"/>
</xsl:message>
<xsl:apply-templates select="sds:component"/>
</xsl:template>

<xsl:template match="sds:component">
<xsl:message>Entering sds:component</xsl:message>
<xsl:message>destdir=</xsl:message>
<xsl:message select="$destdir"/>
<xsl:message>@id=</xsl:message>
<xsl:message select="@id"/>
<xsl:message>nist:filename(@id)=</xsl:message>
<xsl:message select="nist:filename(@id)"/>
<xsl:result-document href="fn:concat($destdir, '/', nist:filename(@id))">
<xsl:message>Creating result document</xsl:message>
<xsl:message>
<xsl:text>Matching component id=</xsl:text>
<xsl:value-of select="@id"/>
</xsl:message>
<xsl:variable name="filename" select="nist:filename(@id)" as="xs:string"/>
<xsl:result-document href="{$filename}">
<xsl:message>
<xsl:text>Creating file </xsl:text>
<xsl:value-of select="$filename"/>
</xsl:message>
<xsl:apply-templates select="*"/>
</xsl:result-document>
</xsl:template>
Expand Down

0 comments on commit 0a53a79

Please sign in to comment.