cvs: phpweb /bin projects_inc.php projects_inc.xsl
| From: | Jesus M. Castagnetto | Date: | Thu, 01 Mar 2001 03:33:49 +0000 |
| Subject: | cvs: phpweb /bin projects_inc.php projects_inc.xsl | ||
| Groups: | php.mirrors | ||
| Request: | Send a blank email to php-mirrors+get-4102@lists.php.net to get a copy of this message | ||
jmcastagnetto Wed Feb 28 19:33:49 2001 EDT
Added files:
/phpweb/bin projects_inc.php
Modified files:
/phpweb/bin projects_inc.xsl
Log:
Script and stylesheet to generate an include file w/ an array of projects.
Sablotron does not seem to be using the disable-output-escaping attribute
in xsl:value-of (J. Clark's xt doesn't either), so we need to s/&/&
to avoid entity translation during the processing.
Index: phpweb/bin/projects_inc.xsl
diff -u phpweb/bin/projects_inc.xsl:1.2 phpweb/bin/projects_inc.xsl:1.3
--- phpweb/bin/projects_inc.xsl:1.2 Wed Feb 28 15:49:43 2001
+++ phpweb/bin/projects_inc.xsl Wed Feb 28 19:33:49 2001
@@ -1,14 +1,3 @@
-<!DOCTYPE xsl:stylesheet [
- <!ENTITY % iso-lat1 SYSTEM "iso-lat1.ent">
- <!ENTITY % iso-lat2 SYSTEM "iso-lat2.ent">
- <!ENTITY % iso-num SYSTEM "iso-num.ent">
- <!ENTITY % iso-pub SYSTEM "iso-pub.ent">
- %iso-lat1;
- %iso-lat2;
- %iso-num;
- %iso-pub;
-]>
-
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
@@ -34,8 +23,9 @@
<xsl:for-each select="match/*">
<xsl:variable name="count" select="../match_count - 1" />
<xsl:if test="name()!='match_count'">
- $project[<xsl:value-of select="$count" />]["<xsl:value-of
- select="name()" />"]="<xsl:value-of select="."
/><xsl:text>";</xsl:text>
+ <xsl:variable name="stuff" select="." />
+ $project[<xsl:value-of select="$count" />]["<xsl:value-of
+ select="name()" />"]="<xsl:value-of select="."
/><xsl:text>";</xsl:text>
</xsl:if>
</xsl:for-each>
</xsl:template>
Index: phpweb/bin/projects_inc.php
+++ phpweb/bin/projects_inc.php
<?php
// harcoded xsl and xml names
// this XSL generates an array of values
$xsl_name = "projects_inc.xsl";
$xsl = implode("",file($xsl_name));
$xml_name = "../backend/projects.xml";
// we need to do a replacement so the entities in the xml will
// not be interpreted by sablotron
$xml = str_replace("&","&",implode("", file($xml_name)));
if (!xslt_process($xsl, $xml, &$result)) {
Header("Status: 500 Server Error");
echo xslt_error();
echo "ERROR ".$php_error_msg;
exit;
} else {
if ($fp = fopen("../include/projects.inc", "w")) {
fwrite($fp, $result);
flush();
fclose($fp);
if (file_exists("../include/projects.inc"))
echo "Success! created ../include/projects.inc";
} else {
echo "Error while saving ../include/projects.inc";
}
}
?>