Skip to content

XML Template Builder

jurialmunkey edited this page Feb 26, 2025 · 1 revision

XML Template Builder

Skin Variables has powerful scripting engine for building custom XML templates

All template files are stored in skin.name/shortcuts

Sub folders can be used to organise your files

Template file

Create a .xmltemplate template file e.g. skin.name/generator/texture_selectbox_include.xmltemplate

The template file uses XML layout with curly brace {key} notation to replace parts via a generator.

Example:

<include name="Texture_SelectBox">
    <texture colordiffuse="{colordiffuse}" border="{border}">{texture}</texture>
</include>

Generator file

Create a json generator e.g. skin.name/shortcuts/skinvariables-generator-textures.xml

{
    "folder": "1080i",
    "output": "script-skinvariables-generator-textures-includes.xml",
    "header": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<includes>",
    "footer": "</includes>",
    "buildv": "0.0.3",
    "getnfo": {
        "colordiffuse": "Skin.String(SelectColorDiffuse)"
    },
    "addnfo": {},
    "global": {},
    "genxml": [
        {
            "template": "generator/texture_selectbox_include.xmltemplate"
        }
    ]
}
Key Description
folder The skin XML folder to output the file to
output The name of the XML file to generate
header The header of the XML file to be added at the top
footer The footer of the XML file to be added at the end
buildv The current version of the file to determine if the file needs to be regenerated. Update build version after making changes
getnfo The list of keys to retrieve info label values for
addnfo The set of rules operations to apply to the keys. Functions equivalent to the scripting engine without actions https://github.com/jurialmunkey/script.skinvariables/wiki/Skin-Scripting-Engine
global The list of globally built templates to insert into keys (Advanced Usage)
genxml The list of xmltemplate files to add to the generated file

Generating the file

RunScript(script.skinvariables,action=buildtemplate,template=textures)

Arguments

Argument Description
template=name The skin.name/shortcuts/skinvariables-generator-{name}.json generator file to use
force Override the buildv and force the template to rebuild
no_reload=True Skip issuing ReloadSkin() command after building

Keywords

Any keyword which is not a skinvariables argument can also be passed directly to the script

Example:

RunScript(script.skinvariables,action=buildtemplate,template=textures,border=10,texture=common/selectbox_rounded.png)

Generates the file skin.name/1080i/script-skinvariables-generator-textures-includes.xml

<?xml version="1.0" encoding="UTF-8"?>
<includes>
<include name="Texture_SelectBox">
    <texture colordiffuse="{colordiffuse}" border="10">common/selectbox_rounded.png</texture>
</include>
</includes>

NOTE: "{colordiffuse}" would be whatever value is in Skin.String(SelectColorDiffuse) at time of running command since we retrieve that in "getnfo".

AddNFO

The set of rules operations to apply to the keys. Functions equivalent to the scripting engine without actions https://github.com/jurialmunkey/script.skinvariables/wiki/Skin-Scripting-Engine

🚧 Documentation under construction

Global

🚧 Documentation under construction

GenXML

🚧 Documentation under construction

Clone this wiki locally