Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Using PHP to parse specific XML tag content?

From: Pavel Lepin <p.lepin@-------.--->
To: NULL
Date: 12/5/2008 10:03:00 AM
Jerry Stuckle <jstucklex@a...> wrote in
<gh9t0a$9lg$1@n...>:
> _Z_ wrote:
>> <?php
>> header() ;
>> $xsl = "MyForm.xsl" ;
>> $command = "xsltproc " . $xsl . " " . $_GET[XML_File] ;
>> $last_line = system( $command ) ;
>> ?>
>> 
>> Of course you have to have xsltproc installed, but I
>> assume you have it. This way enables you to test your XML
>> --> HTML transformation in testing environment. For
>> example: bash# xsltproc MyForm.xsl TestData.xml
> 
> Even more basic that that - you have to have permission to
> execute commands, which many shared hosts do not allow.

The XSL extension (using the very same libxslt that xsltproc
is a command-line front-end for) solves that problem
neatly, of course, but that leads us back to some people
being locked into the set of extensions their hosting
provider deemed 'appropriate' for their needs. My advice
would be changing the provider.

> And you must, of course, be running on a Linux system.

That's not true. At the very least, libxslt and xsltproc run
just fine under Windows using Cygwin, and, unless I'm much
mistaken, the open source *BSD family. I suspect there
wouldn't be any problems running it on any reasonably sane
proprietary UN*X as well. libxml2 and its evil twin libxslt
seem to be among the most widely spread libs in the world.

>> That is the end of the story if you want only to display
>> the data from XML file.
>> 
> 
> Only if you have those tools installed, and can stand the
> default format produced.

Sorry, either that doesn't make sense or I'm missing your
point completely. There's no 'default format' if we're
talking about XSLT. It's a programming language designed 
specifically for document transformation, so the 'default
format' is whatever you choose it to be.

> That often isn't true.  SimpleXML or the DOM 
> functions give you much more control.

True, SimpleXML and DOM give a lot of control and are often
the most reasonable choice for XML processing. But there's
absolutely no point in not having XSLT in your toolbox. If
you need transformations, it's often the most cheap,
efficient and maintainable approach.

-- 
If we want the average quality of computer programs to rise
by 1000%, all we have to do is carefully to select 90% of
the world's programmers, and shoot them. --Richard
Heathfield in <Sfedncgr46kOPmDanZ2dnUVZ8vCdnZ2d@b...>


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent