87 lines
2.9 KiB
HTML
87 lines
2.9 KiB
HTML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<!--
|
|
~~~~~~licensing~~~~~~
|
|
update-management-support
|
|
==========
|
|
Copyright (C) 2020 - 2023 EmDev LLC
|
|
==========
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
you may not use this file except in compliance with the License.
|
|
You may obtain a copy of the License at
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
See the License for the specific language governing permissions and
|
|
limitations under the License.
|
|
~~~~~~/licensing~~~~~~
|
|
-->
|
|
|
|
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions">
|
|
<xsl:output method="text" version="1.0" encoding="UTF-8" indent="yes"/>
|
|
|
|
<xsl:param name="currentVersion" />
|
|
|
|
<xsl:template match="/">
|
|
<xsl:apply-templates select="child::node()" />
|
|
</xsl:template>
|
|
|
|
<xsl:template match="//source-versions/version[@name=$currentVersion]">
|
|
<xsl:text>installPlan = new java.util.ArrayList
|
|
</xsl:text>
|
|
<xsl:for-each select="./plan/child::element()">
|
|
<xsl:call-template name="create-plan-item" />
|
|
</xsl:for-each>
|
|
</xsl:template>
|
|
|
|
<xsl:template name="create-plan-item">
|
|
<xsl:text>$installPlan add [operation="</xsl:text><xsl:value-of select="./name()" /><xsl:text>"</xsl:text>
|
|
<xsl:for-each select="./child::node()[not(self::comment() | self::text())]">
|
|
<xsl:call-template name="create-plan-item-attribute" />
|
|
</xsl:for-each>
|
|
<xsl:for-each select="./attribute()">
|
|
<xsl:call-template name="create-plan-item-attribute" />
|
|
</xsl:for-each>
|
|
<xsl:text>]
|
|
</xsl:text>
|
|
</xsl:template>
|
|
|
|
<xsl:template name="create-plan-item-attribute">
|
|
<xsl:variable name="value" select="." />
|
|
|
|
<xsl:variable name="targetName">
|
|
<xsl:choose>
|
|
<xsl:when test="./name()='feature-name'">feature</xsl:when>
|
|
<xsl:otherwise>
|
|
<xsl:value-of select="./name()" />
|
|
</xsl:otherwise>
|
|
</xsl:choose>
|
|
</xsl:variable>
|
|
|
|
<xsl:variable name="result">
|
|
<xsl:choose>
|
|
<xsl:when test="./name()='reboot'"><xsl:value-of select="concat('"', $value, '"')" /></xsl:when>
|
|
<xsl:otherwise>
|
|
<xsl:choose>
|
|
<xsl:when test="$value='true'">(__TRUE__)</xsl:when>
|
|
<xsl:when test="$value='false'">(__FALSE__)</xsl:when>
|
|
<xsl:when test="number($value)=number($value)"><xsl:value-of select="$value" /></xsl:when>
|
|
<xsl:otherwise><xsl:value-of select="concat('"', $value, '"')" /></xsl:otherwise>
|
|
</xsl:choose>
|
|
</xsl:otherwise>
|
|
</xsl:choose>
|
|
</xsl:variable>
|
|
|
|
<xsl:value-of select="concat(' ', $targetName,'=',$result)" />
|
|
</xsl:template>
|
|
|
|
<xsl:template name="default-remove" match="node()|@*">
|
|
<xsl:apply-templates select="node()|@*" />
|
|
</xsl:template>
|
|
|
|
|
|
|
|
</xsl:stylesheet>
|