Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add XSL files for converting between the new and old profile types (b…
…sc#1206597) Allow to easily convert profiles between "config:type" <=> "t", e.g. simplify the profile or make the profile to work in SLE15-SP2 or older.
- Loading branch information
Showing
5 changed files
with
120 additions
and
1 deletion.
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,45 @@ | ||
# Profile Conversions | ||
|
||
Although AutoYaST keeps backward compatibility so the old profiles should work | ||
in new product releases in some cases it might be useful to do some conversions. | ||
|
||
## :warning: Warning | ||
|
||
*The automatic conversions using XSLT might not produce exact 1:1 results, | ||
there might be minor differences in formatting, also the CDATA sections are | ||
converted to regular data.* | ||
|
||
*Always check the conversion result and adjust it manually if needed.* | ||
|
||
## Converting from the Old Data Types to the New Ones | ||
|
||
Since SLE15-SP3 AutoYaST simplified the data type definitions in the XML | ||
profiles. | ||
|
||
Instead of `config:type="boolean"` you can use a shorter form `t="boolean"`, | ||
for example: | ||
|
||
```xml | ||
<confirm t="boolean">true</confirm> | ||
``` | ||
|
||
To convert the data types automatically you can use the [`new_types.xslt`]( | ||
../xslt/new_types.xslt) file. | ||
|
||
```shell | ||
xsltproc -o profile_new.xml /usr/share/autoinstall/xslt/new_types.xslt profile.xml | ||
``` | ||
|
||
## Converting from the New Data Types to the Old Ones | ||
|
||
This is the opposite process to the previous conversion, it converts the new | ||
data types to the old ones. This is useful if you want to use a new profile | ||
in an old system (SLE15-SP2 and older). The old AutoYaST cannot read the new | ||
data types and it would fail. | ||
|
||
The [`old_types.xslt`](../xslt/old_types.xslt) file converts the short | ||
attributes `t="boolean"` to long attributes `config:type="boolean"`. | ||
|
||
```shell | ||
xsltproc -o profile_old.xml /usr/share/autoinstall/xslt/old_types.xslt profile.xml | ||
``` |
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
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
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,31 @@ | ||
<xsl:stylesheet version="1.0" | ||
xmlns:n="http://www.suse.com/1.0/yast2ns" | ||
xmlns:config="http://www.suse.com/1.0/configns" | ||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | ||
xmlns="http://www.suse.com/1.0/yast2ns" exclude-result-prefixes="n"> | ||
|
||
<!-- | ||
Convert the AutoYaST scheme with the old type specification to the new format. | ||
It simply replaces all "config:type" attributes with simple "t" attribute. | ||
NOTE: The new format is supported in SLES15-SP3 and newer, if you need to use | ||
the profile in older systems you need to use the old "config:type" attributes! | ||
See the old_types.xslt file for the opposite conversion. | ||
--> | ||
|
||
<xsl:output method="xml" indent="yes"/> | ||
|
||
<xsl:template match="node()|@*"> | ||
<xsl:copy> | ||
<xsl:apply-templates select="node()|@*"/> | ||
</xsl:copy> | ||
</xsl:template> | ||
|
||
<xsl:template match="@config:type"> | ||
<xsl:attribute name="t"> | ||
<xsl:value-of select="."/> | ||
</xsl:attribute> | ||
</xsl:template> | ||
|
||
</xsl:stylesheet> |
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,31 @@ | ||
<xsl:stylesheet version="1.0" | ||
xmlns:n="http://www.suse.com/1.0/yast2ns" | ||
xmlns:config="http://www.suse.com/1.0/configns" | ||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | ||
xmlns="http://www.suse.com/1.0/yast2ns" exclude-result-prefixes="n"> | ||
|
||
<!-- | ||
Convert the AutoYaST scheme with the new type specification to the old format. | ||
It simply replaces all "t" attributes with "config:type" attribute. | ||
NOTE: The new format is supported in SLES15-SP3 and newer, if you need to use | ||
a profile in older systems this XSL file will make the profile work there. | ||
See the new_types.xslt file for the opposite conversion. | ||
--> | ||
|
||
<xsl:output method="xml" indent="yes"/> | ||
|
||
<xsl:template match="node()|@*"> | ||
<xsl:copy> | ||
<xsl:apply-templates select="node()|@*"/> | ||
</xsl:copy> | ||
</xsl:template> | ||
|
||
<xsl:template match="@t"> | ||
<xsl:attribute name="config:type"> | ||
<xsl:value-of select="."/> | ||
</xsl:attribute> | ||
</xsl:template> | ||
|
||
</xsl:stylesheet> |