Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Matthew Weier O'Phinney's Blog:
Converting DocBook4 to DocBook5
Jul 20, 2011 @ 14:55:50

In this new post to his blog Matthew Weier O'Phinney looks at the steps he took to convert over the documentation for the Zend Framework 2 from the DocBook 4 formatting over to DocBook 5. Included in the post is some of the (PHP and bash) code he used to make the switch.

Within the Zend Framework 2 repository, I recently performed a conversion from DocBook 4 to 5. [...] Interestingly, for DocBook5 being available in beta since 2005 and an official standard since 2009, there is very little material on migrating from DocBook 4 to 5.

Right from the start he came across a few problems with the included conversion process that're a part of the "db4-update.xsl" definitions. He has a list of eight steps he had to perform on the current DocBook 4 formatted documentation to make the conversion work smoothly including:

  • Identify files containing entity declarations, and skip them.
  • Run the XML file through the db4-upgrade.xsl stylesheet and restore XML entities from the previously placed markers
  • Fix programlisting elements (replaces entities with original text and wraps in CDATA).

He details these steps in a few different sections talking about handling the entities, creating some helper scripts and how to put the two code parts together in a single bash script that can be run on the entire documentation set. If you're just looking for the code, you can find it on his github account.

tagged: convert docbook4 docbook5 xsl entities xml bash

Link:

Ibuildings techPortal:
Transforming XML with PHP and XSL
Dec 16, 2009 @ 14:35:37

New on the Ibuildings techPortal today is an article from Michael looking at XML transformation with PHP and XSL (XML-based "style sheets").

If you want to transform XML from one format to another, and especially if either the input or output XML is complicated or the transformation itself is difficult or awkward to express, then XSL may be a good choice. XSL is the eXtensible Stylesheet Language; a family of three W3C recommendations to do with the transformation and presentation of XML documents. This article will walk through some examples of how XSL and PHP can be used to achieve these types of XML tranformations.

He starts off by describing what XSL looks like and how it relates back to the XML you're applying it to. XSL allows you to take an XML file and work with it as a data source to pull bits of information out of or modify and push back out the other side. He gives three specific examples: pulling information out of an XML file, rewriting URLs and one of the more handy things PHP allows you to do - directly call PHP script inside the XSL document for those things that the normal XSL standards don't include.

tagged: tutorial xml xsl transform

Link:

Alexey Zakhlestin's Blog:
XSLCache in PECL
Aug 27, 2009 @ 12:56:09

In a new post to his blog Alexey Zakhlestin talks about the "rebirth" of the XSLCache extension for PHP, this time as a PECL module.

XSLCache extension for PHP, originally developed by NYTimes started its second life in PECL's repository and I am proud to announce first PECL-release. The XSL Cache extension is a modification of PHP's standard XSL extension that caches the parsed XSL stylesheet representation between sessions for 2.5x boost in performance for sites that repeatedly apply the same transform.

It works with the normal XSL extension with some small differences around which classname to use and a change to the importStylesheet function.

tagged: pecl extension xslcache xsl

Link:

Christian Weiske's Blog:
PEARhd steaming on
Oct 16, 2008 @ 13:49:02

Christian Weiske set out on a project - no small thing - to convert the current PEAR documentation info over to the PhD DocBook rendering system. In a new post he talks about the conversion process and some of the technology involved.

The reason for PhD to exist was that the previously used DSSSL based system was slow: a full build (all formats and all languages) took 24 hours to complete. Further, the tools the system based on were old, rusty and nobody understood why they broke on some machines, but also why they worked on other ones. Having a php-based system for PHP ensures that there is always someone around who can fix it if it's broken. This wasn't the case with the old documentation build system.

The conversion was spurred on by the fact that the PEAR documentation stopped building and more and more people were finding it hard to build on their machines too. He walks through the steps he took - installing PhD, converting over the docs to the DocBook 5 format and the first builds with the new system.

Now that at the XML was shiny, too, it was time to actually use PhD on it. The numbers were amazing: While a build for one format and one language took around 40 minutes on my system (dual core Macbook with 2GHz and 2GiB RAM), building the same with PhD takes 45 seconds!
tagged: pear documentation docbook phd render xml xsl

Link:

Francois Zaninotto's Blog:
Validating a YAML file against a schema in PHP
Sep 24, 2008 @ 17:58:35

Francois Zaninotto submitted a tutorial he's written up about creating a YAML validation script with PHP.

As of today, there is no simple way to validate the syntax of a YAML file in PHP. But with two simple tricks, it takes only a few dozens of lines of code to build a robust validator capable of checking the syntax of any YAML file against a given schema.

He points out that Ruby has a tool for this (kwalify) but PHP doesn't. He creates his own with the help of the sfYaml component from the symfony framework, translating the YAML data into something PHP can parse more easily - XML. He passes this through an XSL parser and uses the DOM XML schemaValidate function to check it against the given schema.

tagged: yaml validate tutorial schema xsl domxml sfyaml symfony framework

Link:

PHP.net:
Update to PHP 5.2.6 Release (XSL & IMAP)
May 06, 2008 @ 13:49:05

The PHP group has made a two quick updates to the recent release of PHP 5.2.6 for the Windows users out there:

The Windows installers and archives were missing the XSL and IMAP extensions.

These updated packages can be downloaded from the Downloads page on PHP.net as usual (with each updated package having a note indicating the change).

tagged: xsl phpnet update imap extension windows installer

Link:

Zend Developer Zone:
XML and PHP 5
Aug 01, 2007 @ 15:13:00

The Zend Developer Zone has a new tutorial posted looking at PHP5 and the new XML tools that it has to offer - as broken up into categories:

Things are a bit different using XML in PHP 5. In a similar scenario, you could use one of the new native extensions, like DOM or SimpleXML, to manipulate the XML data tree. This tree can then be passed directly to and used by the XSL extension without incurring any additional overhead. There is no serialization nor copying involved; ext/xsl is able to work directly with the XML tree it is given, resulting in a significant improvement in use of system resources as compared to coding a similar task in PHP 4. So now that you have an idea why XML support got a face lift, you might like to know about the different tools available to you.
tagged: xml php5 tutorial introduction dom xsl xmlreader xmlwriter simplexml xml php5 tutorial introduction dom xsl xmlreader xmlwriter simplexml

Link:

Zend Developer Zone:
XML and PHP 5
Aug 01, 2007 @ 15:13:00

The Zend Developer Zone has a new tutorial posted looking at PHP5 and the new XML tools that it has to offer - as broken up into categories:

Things are a bit different using XML in PHP 5. In a similar scenario, you could use one of the new native extensions, like DOM or SimpleXML, to manipulate the XML data tree. This tree can then be passed directly to and used by the XSL extension without incurring any additional overhead. There is no serialization nor copying involved; ext/xsl is able to work directly with the XML tree it is given, resulting in a significant improvement in use of system resources as compared to coding a similar task in PHP 4. So now that you have an idea why XML support got a face lift, you might like to know about the different tools available to you.
tagged: xml php5 tutorial introduction dom xsl xmlreader xmlwriter simplexml xml php5 tutorial introduction dom xsl xmlreader xmlwriter simplexml

Link:

IBM developerWorks:
Turn SQL into XML with PHP
Jul 25, 2007 @ 14:21:00

On the IBM developerWorks site today, there's a new tutorial by Vikram Vaswani walking through the use of the XML_Query2XML PEAR package to pull data from your SQL database and push it into an XML structure.

Ever wished for an easy way to transform SQL result sets into XML? It's a PEAR package named XML_Query2XML, and it provides a comprehensive framework to efficiently turn the results of a database query into a customizable XML document. This article introduces the package, and demonstrates useful real-world applications, including using it with XSL and XPath, combining it with data from external Web services, and creating database dump files.

They go through the installation and the steps to create the XML:

  • Convert SQL to XML
  • Transform XML output with XSL
  • Customize XML output
  • Work with SQL joins
  • Filter SQL records with XPath
  • Merge data from multiple sources
  • Create database backups

Check out the full tutorial for an excellent guide to using this powerful PEAR package.

tagged: pear xmlquery2xml xsl xpath join install backup pear xmlquery2xml xsl xpath join install backup

Link:

IBM developerWorks:
Turn SQL into XML with PHP
Jul 25, 2007 @ 14:21:00

On the IBM developerWorks site today, there's a new tutorial by Vikram Vaswani walking through the use of the XML_Query2XML PEAR package to pull data from your SQL database and push it into an XML structure.

Ever wished for an easy way to transform SQL result sets into XML? It's a PEAR package named XML_Query2XML, and it provides a comprehensive framework to efficiently turn the results of a database query into a customizable XML document. This article introduces the package, and demonstrates useful real-world applications, including using it with XSL and XPath, combining it with data from external Web services, and creating database dump files.

They go through the installation and the steps to create the XML:

  • Convert SQL to XML
  • Transform XML output with XSL
  • Customize XML output
  • Work with SQL joins
  • Filter SQL records with XPath
  • Merge data from multiple sources
  • Create database backups

Check out the full tutorial for an excellent guide to using this powerful PEAR package.

tagged: pear xmlquery2xml xsl xpath join install backup pear xmlquery2xml xsl xpath join install backup

Link:


Trending Topics: