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

Fixed stylesheets #2

Merged
merged 1 commit into from
Jun 4, 2019
Merged
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
3 changes: 2 additions & 1 deletion build/ci-cd/generate-schema-documentation.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ while IFS="|" read path gen_schema gen_converter gen_docs || [[ -n "$path" ]]; d
extension="${filename##*.}"
filename="${filename%.*}"
base="${filename/_metaschema/}"
converter="$working_dir/xml/convert/${base}_xml-to-json-converter.xsl"

#split on commas
IFS=, read -a formats <<< "$gen_docs"
Expand All @@ -58,7 +59,7 @@ while IFS="|" read path gen_schema gen_converter gen_docs || [[ -n "$path" ]]; d
esac

echo "${P_INFO}Generating ${format^^} model documentation for metaschema '$metaschema'.${P_END}"
xsl_transform "$OSCALDIR/build/metaschema/xml/produce-and-run-either-documentor.xsl" "$metaschema" "" "target-format=${format}" "output-path=$working_dir/docs/content/documentation/schemas"
xsl_transform "$OSCALDIR/build/metaschema/xml/produce-and-run-either-documentor.xsl" "$metaschema" "" "target-format=${format}" "example-converter-xslt-path=${converter}" "output-path=${working_dir}/docs/content/documentation/schemas"
cmd_exitcode=$?
if [ $cmd_exitcode -ne 0 ]; then
echo "${P_ERROR}Generating ${format^^} model documentation failed for '$metaschema'.${P_END}"
Expand Down
4 changes: 2 additions & 2 deletions build/ci-cd/saxon-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ xsl_transform() {

if [[ ! -z "$output_file" ]]; then
java -cp "$classpath" net.sf.saxon.Transform \
$extra_params "-warnings:silent" "-o:$output_file" "-s:$source_file" "$stylesheet"
"-warnings:silent" "-o:$output_file" "-s:$source_file" "$stylesheet" "${extra_params}"
else
java -cp "$classpath" net.sf.saxon.Transform \
$extra_params "-warnings:silent" "-s:$source_file" "$stylesheet"
"-warnings:silent" "-s:$source_file" "$stylesheet" "${extra_params}"
fi

if [ "$?" -ne 0 ]; then
Expand Down
17 changes: 11 additions & 6 deletions build/metaschema/xml/produce-and-run-either-documentor.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,29 @@

<!-- for development -->
<!--<xsl:param name="target-format" select="()"/>-->
<xsl:param name="target-format" as="xs:string">xml</xsl:param>
<xsl:param name="target-format" as="xs:string">json</xsl:param>
<xsl:param name="output-path" as="xs:string">docs/content/documentation/schemas</xsl:param>

<xsl:import href="../lib/metaschema-compose.xsl"/>
<xsl:variable name="source" select="$composed-metaschema"/>

<xsl:variable name="metaschema-code" select="$source/*/short-name"/>

<xsl:param name="example-converter-xslt-path" as="xs:string">blah</xsl:param>
<!--"C:\Users\wap1\Documents\OSCAL\docs_jekyll_uswds\content\documentation\schemas\oscal-catalog\catalog.md"-->

<xsl:variable name="result-path" select="($output-path || '/_' || $metaschema-code || '-' || $target-format)"/>

<!-- This template produces an XSLT dynamically by running an XSLT with a parameter set. -->
<xsl:variable name="xslt">
<xsl:variable name="runtime" select="map {
'xslt-version' : 3.0,
'stylesheet-location' : 'produce-either-documentor.xsl',
'source-node' : $source,
'stylesheet-params' : map { xs:QName('target-format'): $target-format,
xs:QName('schema-path'): document-uri(/) } }" />
'xslt-version' : 3.0,
'stylesheet-location' : 'produce-either-documentor.xsl',
'source-node' : $source,
'stylesheet-params' : map { xs:QName('target-format'): $target-format,
xs:QName('schema-path'): document-uri(/),
xs:QName('example-converter-xslt-path'): $example-converter-xslt-path
} }" />

<!-- The function fn:transform() returns a map, whose primary results are under 'output'
unless a base output URI is given
Expand Down
2 changes: 1 addition & 1 deletion build/metaschema/xml/produce-either-documentor.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

<xsl:param name="schema-path" as="xs:string" select="document-uri(/)"/>

<xsl:param name="example-converter-xslt-path" as="xs:string" expand-text="true">../../{$target-format}/convert/{/METASCHEMA/short-name}_{$source-format}-to-{$target-format}-converter.xsl</xsl:param>
<xsl:param name="example-converter-xslt-path" as="xs:string">blah2</xsl:param>

<xsl:variable name="example-converter-xslt" select="resolve-uri($example-converter-xslt-path,$schema-path)"/>

Expand Down