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…
- Auto-build on file save
- Precise error and warning report inside the “Problems” view (broken since 0.2.0)
- XSL parameters are automagically set to the current date, url from the page to any another, and so on
- Automatic directory listing
- Integrated help inside Eclipse
- Wizards to get you started
- Works with Eclipse 3.4+
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”.
Your First Project With Stylo Plume
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.
Your Second Project With Stylo Plume
If you don’t feel like doing all this by hand, just use one of the wizards available to create a working project.
- Removed dependency on Xalan
- Added options to the dir:// protocol
- The error report is broken
- Fixed bugs when creating projects not using the default location
- Better error report for jdk 1.4 (of course, it has to differ from jdk 1.3...)
- Bug fixes (more to come)
- Incremental builder (does not check dependency yet)
- Minor speed improvements
- Wizards to create simple XHTML projects
- Automatic directory listing (user request)
- Bug fixes
- Stupid bug fix, discovered 10 minutes after the last release :-(
- Wizard to create empty projects
- Warnings are reported in the Tasks List
- Support of several XSL sheets
- Bug fixes
- Precise error report for XSL sheets
- Critical bug fix
- Dialog to pick directories (experimental)
- Support of <xsl:import> and <xsl:include>
- Save settings in a file instead of Eclipse's registry (useful for CVS)
- Automatic rebuild after a setting modification (i.e. changing the source folder, the name of the XSL sheet, aso)
- Ability to specify new parameters
- Use of locale for dates
- Integrated help inside Eclipse (very small for the time being)
- Better error report
- First public release
Use the update manager and create a bookmark to http://www.jnegre.org/updates/site.xml.
The source code is hosted on bitbucket.org.
Many thanks to Eli Lopian, Laurent Fourrier, Lars Høidahl and Victor Volle for their valuable feedback and suggestions.