Announcement

Collapse
No announcement yet.

XML zu XSLT

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

  • XML zu XSLT

    Hallo zusammen

    Ich mochte eine XML Datei in Xhtml Format (Mehrere Tabellen)erzeugen soweit so gut ..Die Datei fangt so an

    <ap:Map Dirty=".......>
    <ap:Topic ..> </ap:Topic>
    <ap:Onegroup..></ap:Onegroup>
    ...
    ...
    ...

    </ap:Map>

    Meine frage ist ob zumbeispiel der Erste Element hier "ap:Map" oder einfach Map ??diese "ap" was heisse das ?ist eine Xml Forme ,habe schon in Internet gesucht aber nix gefunden daruber .Um anzufangen wolte ich erste ein enfach Tabelle(mi der XML Datei) in Browser ausgeben , Der code:

    <xsl:template match="ap:Map">

    <html>
    <body>

    <table border="1">
    <tr>
    <td>Haupt tknote </td>
    <td><xsl:apply-templates select="ap:OneTopic"/>
    <xsl:apply-templates select="ap:StyleGroup"/>
    <xsl:apply-templates select="ap:MapViewGroup "/>
    <xsl:apply-templates select="apocumentGroup"/>
    <xsl:apply-templates select="ap:MarkersSetGroup"/>
    </td>
    </tr>
    </table>
    </body>
    </html>

    </xsl:template>

    </xsl:stylesheet>
    Aber ich kann nix auf dem Browser sehen
    Danke ..

  • #2
    Die Elemente liegen offenbar im ap-Namensraum. Gib die verwendete Namensraum-URI entsprechend im XSLT-Stylesheet an (xmlns:ap="..."):
    Code:
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      xmlns:ap="http://example.com/ap">
    
      <!-- ... -->
    
    </xsl:stylesheet>
    Nun sollte der Zugriff auf ap:Map usw. funktionieren.

    Comment


    • #3
      Danke .Ich bekomme irgenwas aber nicht mal der Tabelle ..habe sogar versucht am Anfang der Document <h1>bjb</h1> aber das wird nicht ausgegeben

      <xsl:template match="ap:Map">

      <html>
      <body>
      <h1>hbkh<7h1>

      <table border="1">
      <tr>
      <td>Haupt tknote </td>
      <td><xsl:apply-templates select="ap:OneTopic"/>
      <xsl:apply-templates select="ap:StyleGroup"/>
      <xsl:apply-templates select="ap:MapViewGroup "/>
      <xsl:apply-templates select="apocumentGroup"/>
      <xsl:apply-templates select="ap:MarkersSetGroup"/>
      </td>
      </tr>
      </table>
      </body>
      </html>

      </xsl:template>

      </xsl:stylesheet>

      Comment


      • #4
        Ist der ap-Namensraum deklariert? Zeige ansonsten etwas mehr vom XML-/XSLT-Code.

        Comment


        • #5
          ja der ap-Namensraum ist deklarier ,

          <?xml version="1.0"?>
          <xsl:stylesheet version="1.0"
          xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
          xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
          xmlns:ap="http://example.com/ap">


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

          <xsl:template match="ap:Map">

          <html>
          <body>
          <h1>Polas</h1>
          <table border="1">
          <tr>
          <td>Patre</td>
          <td><xsl:apply-templates select="ap:OneTopic"/>
          <xsl:apply-templates select="ap:StyleGroup"/>
          <xsl:apply-templates select="ap:MapViewGroup "/>
          <xsl:apply-templates select="apocumentGroup"/>
          <xsl:apply-templates select="ap:MarkersSetGroup"/>
          </td>
          </tr>
          </table>
          </body>
          </html>

          </xsl:template>

          </xsl:stylesheet>

          Comment


          • #6
            Naja, es muss schon der Namensraum aus dem XML-Dokument sein, der mit example.com war natürlich nur ein Beispiel.

            Comment


            • #7
              Danke es funktioniert

              Comment

              Working...
              X