- Jérôme Nègre's piece of web -
This plug-in allows one to apply XSL sheets to specific files inside a given source directory. Its first goal was to make easier the creation of an homogeneous web site, but it can be used for other things, such as producing SVG graphics, PHP pages, RTF documents...
Main features:
To have a more precise idea of what you can do with this plug-in, read the following paragraph "Your First Project With Stylo Plume".
Feedback on this plug-in is wanted, please tell me what you like/dislike.
First, create a new simple project (do not use one of Stylo Plume's wizards). Inside that project, create three folders (directories): "src", "src/images" and "template". Now right click on the project, and select Stylo Plume > Use With Stylo Plume. An error message should appear in the task list saying that the project was not built: this is because there is no XSL sheet yet.
So, our next task will be to create such a beast. Create a new file "style.xsl" inside the folder "template", and edit it to look like this:
<?xml version="1.0" encoding="iso-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" indent="no" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/> <!-- Parameters (set by StyloPlume) --> <xsl:param name="projectDir" select="'unknown/'"/> <xsl:param name="lastUpdate" select="'unknown'"/> <xsl:param name="imagePath" select="'unknown/'"/> <!-- Templates --> <xsl:template match="/sp_page"> <html> <head> <title><xsl:value-of select="@title"/></title> </head> <body> <p align="center"> <img alt="logo"> <xsl:attribute name="src" > <xsl:value-of select = "concat($imagePath,'logo.png')" /> </xsl:attribute> </img> </p> <div style="background-color:#EAEAEA;"> <xsl:apply-templates/> </div> <xsl:apply-templates select="document(concat($projectDir,'template/footer.xml'))"/> </body> </html> </xsl:template> <xsl:template match="sp_lastupdate"> <xsl:value-of select="$lastUpdate"/> </xsl:template> <xsl:template match="*"> <xsl:copy> <xsl:copy-of select="@*"/> <xsl:apply-templates/> </xsl:copy> </xsl:template> <xsl:template match="text()"> <xsl:value-of select="."/> </xsl:template> </xsl:stylesheet>
Now that we have an XSL sheet, the project can be setup. Right click on the project, and select Properties: a new category, "Stylo Plume", should be available. Edit the template file to "template/style.xsl". You should also create two parameters: lastUpdate (type=date, format="en-US MMMM d, yyyy") and imagePath(type=url to, format="images/"). ProjectDir is always set by StyloPlume, you needn't specify it. Once the dialog is closed, a new folder, "bin", is created.
This XSL sheet refers to two other documents: logo.png inside "src/images", and footer.xml inside "template". Put any PNG picture inside "src/images", and rename it logo.png. Footer.xml is an XML file, and should look something like this:
<?xml version="1.0" encoding="iso-8859-1"?> <div style="text-align:center;"> Last update: <sp_lastupdate/> </div>
Now, you can write your first page with Stylo Plume. Create a new file inside "src", and name it mypage.html.spf. The file transformed by Stylo Plume will be mypage.html inside "bin". The content of mypage.html.spf uses the templates defined by style.xsl:
<?xml version="1.0" encoding="iso-8859-1"?> <sp_page title="My Page"> <p> Hello World! </p> </sp_page>
Now have a look inside the folder "bin": all files whose extension is spf have been transformed, while others have just been copied. Open bin/mypage.html with your favorite browser, you should see a page with your logo at the top, the traditional "Hello World!", and the time of the last compilation.
You can have as many folders as you want inside "src", Stylo Plume will always give to your XSL sheet the correct path to the image dir.
0.1.13 |
|
0.1.12 |
|
0.1.11 |
|
0.1.10 |
|
0.1.9 |
|
0.1.8 |
|
0.1.7 |
|
0.1.6 |
|
0.1.5 |
|
0.1.4 |
|
0.1.3 |
|
0.1.2 |
|
0.1.1 |
|
0.1.0 |
|