NOTA : xpp is the namespace used by default, but you can change it with the -n, --namespace option.
For more details about a tag, follow the given link for the tag.
<xpp:define name="NAME">...</xpp:define> : définition of a macro named NAME.<xpp:expand select="NAME">...</xpp:expand> : expansion of the macro named NAME.<xpp:expand href="FILENAME"/> : inclusion of the content of the file named FILENAME.<xpp:ifeq select="NAME" value="VALUE">...</xpp:ifeq> : the content of this tag is skipped unless variable named NAME has VALUE as value.<xpp:bloc>...</xpp:bloc> : this tag has no effect by itself, but is required under some circumtances by above tags.
File common.xcf :
<xpp:bloc xmlns:xpp="http://zeusw.org/epeios/xpp"> <xpp:define name="LinuxURL"> <xpp:bloc>linuxfr.org</xpp:bloc> </xpp:define> <xpp:define name="WindowsURL"> <xpp:bloc>windowsfr.org</xpp:bloc> </xpp:define> <xpp:define name="Linux"> <xpp:bloc> <xpp:define name="Directory"> <xpp:bloc>/home/dupond/</xpp:bloc> </xpp:define> <xpp:define name="RootURL"> <xpp:expand select="LinuxURL"/> </xpp:define> </xpp:bloc> </xpp:define> <xpp:define name="Windows"> <xpp:bloc> <xpp:define name="Directory"> <xpp:bloc>c:\Documents\Dupond\</xpp:bloc> </xpp:define> <xpp:define name="RootURL"> <xpp:expand select="WindowsURL"/> </xpp:define> </xpp:bloc> </xpp:define> <xpp:define name="File"> <xpp:bloc> <xpp:expand select="Directory"/> <xpp:expand select="FileName"/> </xpp:bloc> </xpp:define> <xpp:ifeq select="OS" value="Linux"> <xpp:expand select="Linux"/> </xpp:ifeq> <xpp:ifeq select="OS" value="Windows"> <xpp:expand select="Windows"/> </xpp:ifeq> <SomeFile> <xpp:expand select="File"> <xpp:define name="FileName"> <xpp:bloc>SomeFile</xpp:bloc> </xpp:define> </xpp:expand> </SomeFile> <OtherFile> <xpp:expand select="File"> <xpp:define name="FileName"> <xpp:bloc>OtherFile</xpp:bloc> </xpp:define> </xpp:expand> </OtherFile> <SomeURL> <xpp:bloc>http://</xpp:bloc> <xpp:expand select="RootURL"/> <xpp:bloc>/something</xpp:bloc> </SomeURL> </xpp:bloc>
File linux.xcf :
<?xml version="1.0" encoding="ISO-8859-1"?> <Configuration xmlns:xpp="http://zeusw.org/epeios/xpp"> <xpp:set name="OS" value="Linux"/> <xpp:expand href="common.xcf"/> </Configuration>
File windows.xcf :
<?xml version="1.0" encoding="ISO-8859-1"?> <Configuration xmlns:xpp="http://zeusw.org/epeios/xpp"> <xpp:set name="OS" value="Windows"/> <xpp:expand href="common.xcf"/> </Configuration>
By launching
expp linux.xcf
you obtain following result :
<?xml version="1.0" encoding="ISO-8859-1"?> <Configuration> <SomeFile>/home/dupond/SomeFile</SomeFile> <OtherFile>/home/dupond/OtherFile</OtherFile> <SomeURL>http://linuxfr.org/something</SomeURL> </Configuration>
By launching
expp windows.xcf
you obtain following result :
<?xml version="1.0" encoding="ISO-8859-1"?> <Configuration> <SomeFile>c:\Documents\Dupond\SomeFile</SomeFile> <OtherFile>c:\Documents\Dupond\OtherFile</OtherFile> <SomeURL>http://windowsfr.org/something</SomeURL> </Configuration>