php-windows Digest 30 Jun 2004 08:30:16 -0000 Issue 2301

Topics (messages 24078 through 24082):

Re: Parsing pageranges
        24078 by: Luis Moreira

Re: Parsing pageranges [solved]
        24079 by: George Pitcher

HTML_entities woe
        24080 by: George Pitcher

> Problems with php_domxml and his xslt support (output settings not used)
        24081 by: Weyert de Boer

HTTP 400 Bad Request
        24082 by: Stephen Cassidy

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [EMAIL PROTECTED]


----------------------------------------------------------------------
--- Begin Message ---
George Pitcher wrote:

Hi,

I have several systems running which gather, store and process bibliographic
data. I have treated pageranges on the basis of two fields per range - start
and end, with supplemantary ranges available as well.

I've never had to deal with more than 3 ranges in a reference: chapter,
references and notes. Now, a client has asked for 6 ranges. I could
futureproof this by putting 10 ranges in but I got to thinking about how
Pagemaker used to handle prining (and how Micro$oft do now) where I can note
a range as (example) 1-4,6,8-10.

I need to be able to parse this type of string so that I can identify the
number of pages being referenced.

I also need to ensure that the user hasn't entered a mixed range such as
xiii-5 (I know that the second part of that is 1-5 but I don't know what the
highest roman numeral was). I do know how to handle the roman calculations,
so that's a side issue.

I'm guessing that regex is the way to go, but whenever I'm confronted with
it, I look for a chinese interpreter.

Any suggestions?


George in Oxford



I am not used to work with regex, either, so here are  my 2pence...
Just writing as I think, I would say something like

- Explode the string looking for the comma
- If the resulting "pieces" are numerical, fine.
- If not, explode them indivudually looking for the hiphen
- If the results are numeric, fine
- If in between something "non-numeric" is found, you have an error

This, obviously, ignoring the roman numerals...


--- End Message ---
--- Begin Message ---
Hi,

Solved it but there may be a more elegant/efficient way?

my code:

==============================================
<?php
$range = $_POST['range'];
$x=0;
$pc=0;
$rg = explode(",",$range);
$rc = sizeof($rg);
while( $x < $rc ){
        $z = explode("-",$rg[$x]);
        if (sizeof($z)==1){
                $pc++;
        } else {
                $pc+=(($z[1]-$z[0])+1);
        }
        $x++;
}
echo="Range has $rg groups and $pc pages<br><br>";
?>

George
> -----Original Message-----
> From: George Pitcher [mailto:[EMAIL PROTECTED]
> Sent: 29 June 2004 12:51 pm
> To: [EMAIL PROTECTED]
> Subject: [PHP-WIN] Parsing pageranges
>
>
> Hi,
>
> I have several systems running which gather, store and process
> bibliographic
> data. I have treated pageranges on the basis of two fields per
> range - start
> and end, with supplemantary ranges available as well.
>
> I've never had to deal with more than 3 ranges in a reference: chapter,
> references and notes. Now, a client has asked for 6 ranges. I could
> futureproof this by putting 10 ranges in but I got to thinking about how
> Pagemaker used to handle prining (and how Micro$oft do now) where
> I can note
> a range as (example) 1-4,6,8-10.
>
> I need to be able to parse this type of string so that I can identify the
> number of pages being referenced.
>
> I also need to ensure that the user hasn't entered a mixed range such as
> xiii-5 (I know that the second part of that is 1-5 but I don't
> know what the
> highest roman numeral was). I do know how to handle the roman
> calculations,
> so that's a side issue.
>
> I'm guessing that regex is the way to go, but whenever I'm confronted with
> it, I look for a chinese interpreter.
>
> Any suggestions?
>
>
> George in Oxford
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---
--- Begin Message ---
I'm using fx to extract data from a FileMaker database and am encountering
some HTML entity issues. This data is going into a pdf page, so isn't being
displayed on the web.

The  copyright symbol comes out like: &#169; and I've noticed a couple of
accented characters as well.

The data was put on by a Mac client so its natural for them not to use the
usual coding.

Can anyone point me in the right direction to get this sorted?

html_entity_decode() didn't work (and didn't show as a php function in DW).

George

--- End Message ---
--- Begin Message ---
Hi

I am using the domxml php extension for transforming XSLT, only I have the problem that it doesnt take some of my <XSL:output> settings into acocunt. For example when I set ident="yes" it doesn't ident the output, and when I enabled the "omit-xml-declaration"-attribute this <?xml> declaration is this availabe, which should not in the output.

The XSL:Output I use:

<xsl:output
                doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
                doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";
                encoding="UTF-8"
                method="xml"
                indent="yes"
                omit-xml-declaration="yes"
        />

When I use the exact same XSLT file with php_xslt extension/Sablotron the output is as expected both settings are taken into account. Does anyone know if I am doing something wrong in my code? (see code below)
I think it's a bug in the php_xmldom extension, because when I use xsltproc.exe (standalone version libxsl) the output is okay too.



The code I use for transforming the xml file can be find below:

//
// Process the XML file together with the XSLT file to generate the apporiate XHTML page...
$xml = domxml_open_mem( $result ); // create a XmlDocument-object with the return xml file...
if ( !$xml ) {
die( "Error while parsing the XML document. Application has aborted." );
}


// assign the XSLT stylesheet for this XML document...
$xsl = domxml_xslt_stylesheet_file( $xsl_file );

// process the XSLT stylesheet with the assigned XML document...
$result = NULL;
$result = $xsl->process( $xml );

if ( DEBUG_MODE ) {                     
        $result->dump_file( $output_file );
}
echo $result->dump_mem();
$xml->free(); // dispose the object

Yours,

Weyert de Boer ([EMAIL PROTECTED])

Check out my blog: http://www.weyert.com/
--- End Message ---
--- Begin Message ---
Hi all, I am fairly new to this (attended a beginners course last week) and
I have been asked to install PHP on or 4 web servers (spread over 4 sites),
all the servers are exactly the same running Windows XP and IIS 5.

I downloaded the latest PHP 4.3.7 and managed to install it perfectly on 3
of the servers the last one that I tried all seemed to install correctly but
I keep getting HTTP error 400 Bad request. Someone suggested going to the
C:\PHP directory and creating a php document in there called test.php with
<?phpinfo();?> to test I did this and PHP is working so I am baffled now.
The only difference I can see with the output of the file on a working
server and the one that is not working is the Configuration File (php.ini)
Path on the server that is not working this is set to
"C:\Documents and Settings\administrator.INTERNAL\WINDOWS\php.ini " and the
one that works
"C:\WINNT\php.ini ". Where is the path set? I installed PHP one each server
using the same logon account?

I hope someone can help as this is starting to drive me mad.

Thanks

Stephen

--- End Message ---

Reply via email to