XML mit Hilfe von xsl darstellen

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • XML mit Hilfe von xsl darstellen

    So, hallo erstmal,
    vorneweg, ich will kein XML lernen, werde aber gezwungen eine Hausarbeit damit zu verfassen
    Jetzt eine Frage, ich hab mir eine XSD geschrieben und damit eine XML file automatisch erzeugt, der Anfang sieht so aus:
    PHP Code:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <?xml-stylesheet type="text/xsl" href="style.xsl"?>
    <p1:ML2 xmlns:p1="http://www.ML2.org" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://www.ML2.org 
    file:///c:/Dokumente%20und%20Einstellungen/David/Desktop/Landmarks.xsd">
        <p1:geographic_point>
            <p1:longitude>string</p1:longitude>
            <p1:latidude>string</p1:latidude>
            <p1:Landmark>
                <p1:street>string</p1:street>
                <p1:city>string</p1:city>
                <p1:zipcode>string</p1:zipcode>
                <p1:country>string</p1:country>
                <p1:Comments>
                    <p1:commenttext>string</p1:commenttext>
                    <p1:author>string</p1:author>
                </p1:Comments>
    ...
    ...
    ...
    ..
    ..
    Jetzt habe ich hier eine style.xsl
    PHP Code:
    <xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

    <
    xsl:output method='html' version='1.0' encoding='UTF-8' indent='yes'/>


    <
    xsl:template match="/">
        <
    HTML>
         <
    Head>
          <
    Title><xsl:value-of select="ML2/geographic_point"/></Title>
         </
    Head>
         <
    Body>
          <
    H1>Ein Test</H1>
           <
    table border="1">
            <
    xsl:for-each select="ML2/geographic_point">
             <
    tr>
              <
    td> <xsl:value-of select="longitude"/> </td>
              <
    td> <xsl:value-of select="latitude"/> </td>
             </
    tr>
            </
    xsl:for-each>
           </
    table>
         </
    Body>
        </
    HTML>
      </
    xsl:template>

    </
    xsl:stylesheet
    Aber ich kann machen was ich will, aber ich finde nie auch nur ein
    value-of Select Element, was mache ich falsch ????
    Also es funktioniert einfach nicht....
    Kann mir wer helfen, bin echt ein laie..
    THX!!!

  • #2
    Schnomal versucht, den Namespace im XPath mit anzugeben?

    Comment


    • #3
      keine Ahnung wovon du redest

      Comment


      • #4
        so kommst du nicht weit...

        Comment

        Working...
        X