0

hi sir! little bit lost Pls help!
how can I add css file for may xml created from php?

    <?php
    bla bla bla.....
    ---------<?xml-stylesheet type="text/css" href="markers.css"?>-------how can i add this line?
    echo '<markers>';
    while ($row = @mysql_fetch_assoc($result)){
    echo '<marker ';
    echo 'name ="' . parseToXML($row['name']) . '" ';
    echo 'address ="' . parseToXML($row['address']) . '" ';
    echo 'lat ="' . $row['lat'] . '" ';
    echo 'lng ="' . $row['lng'] . '" ';
    echo '/>';
    }
    echo '</markers>';
    ?>
2
Contributors
1
Reply
19
Views
3 Years
Discussion Span
Last Post by AndrisP
0

Link to css file put in XSLT file, like:

<?php

header("Content-type:text/xml;charset=utf-8");
print "<?xml version=\"1.0\" encoding=\"utf-8\"?>
<?xml-stylesheet type=\"text/xsl\" href=\"transform.xsl\" ?>";

echo '<markers>';
    while ($row = @mysql_fetch_assoc($result)){
    echo '<marker ';
    echo 'name ="' . parseToXML($row['name']) . '" ';
    echo 'address ="' . parseToXML($row['address']) . '" ';
    echo 'lat ="' . $row['lat'] . '" ';
    echo 'lng ="' . $row['lng'] . '" ';
    echo '/>';
    }
echo '</markers>';

?>

File "transform.xsl" e.g.

<?xml version="1.0" encoding="utf-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/">
    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
            <link rel="stylesheet" type="text/css" href="/style.css" />
            <title>My Page TITLE</title>
        </head>
        <body>
            <xsl:apply-templates />
        </body>
    </html>
</xsl:template>

<xsl:template match="/markers">
    <xsl:for-each select="marker">
        ................
        ................
        ................
    </xsl:for-each>
</xsl:template>

Edited by AndrisP

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.