Core Jelly - structuring scripts using import
Part 10 in an ongoing series about Jelly...
Here is a Jelly script that uses an import tag.
Importing scripts gives the Jelly programmer a way of including reusable snippets, or externalising content.
Let's look at it in a bit more detail:
1:<?xml version="1.0" ?>
2:<jelly xmlns="jelly:core" trim="no">
3:
4: <import uri="aJellyScript.jelly" inherit="false" />
5:
6:</jelly>
2:<jelly xmlns="jelly:core" trim="no">
3:
4: <import uri="aJellyScript.jelly" inherit="false" />
5:
6:</jelly>
Line 1 Identifies it as an XML 1.0 document.
Line 2 Is the root element, and it specifies that the default xml namespace uses tags from the core taglib.
Line 4 Imports the script
aJellyScript.jelly relative to the current script. Since the inherit attribute is set to false, the imported script knows nothing of any variables set in the main script.Line 6 Closes the script.