Announcement

Collapse
No announcement yet.

Probleme mit XSLT-Stylesheet

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

  • Probleme mit XSLT-Stylesheet

    Hallo Leute,

    ich habe da ein Problem:

    Mit dem folgenden Stylesheet (rot) bekomme ich folgenden XML-Output (blau).

    Code:
    <?xml version="1.0" encoding="iso-8859-1"?>
    <xsl:stylesheet
        version="1.0"
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
        xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"
    >
     
      <!--<xsl:output method="xml" encoding="utf-8"/>-->
     
     
       <xsl:template match="/">
    	<mod>
    
    	<xsl:apply-templates select="w:document/w:body/w:p/w:pPr/w:pStyle"  />
    	</mod>
       </xsl:template>
      
    
       
     <xsl:template match="w:pStyle">
     
     <xsl:if test="@w:val='Descriptive'">  
    	   
    	<descriptive prodclass-1="" infoclass-1="" infoclass-2="">
    	<xsl:value-of select="following::w:t"/>
    	</descriptive>
    	
     </xsl:if>
     
    </xsl:template>
    
    </xsl:stylesheet>




    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <mod xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main">
    	<descriptive prodclass-1="" infoclass-1="" infoclass-2="">Aufpassen Lebensgefahr!</descriptive>
    	
    </mod>



    Jetzt meine Frage: Warum hat das mod-Element von XML-Output (blau) den xmlns:w-Namespace als Attribut? Das soll nicht sein! Das mod-Element soll da gar nichts haben. Wie kann man das lösen. Was ist evtl. am Stylesheet falsch?

    Danke für eure Hilfe.

  • #2
    Füge das Attribut
    exclude-result-prefixes="w"
    zum xsl:stylesheet-Element hinzu.

    Comment


    • #3
      Hallo, vielen Dank für die Lösung. Super!

      Comment

      Working...
      X