xsl:result transformation not possible

Chris Ha

I have problems transforming XML Code. I want to transform each div type="article" Element into another new file. My XML file looks like this:

    <?xml version="1.0" encoding="UTF-8"?>
    <!--Die Texte sind eine Abwandlung des von www.editura.de erstellten und von TextGrid weiterverarbeiteten und zur Verfügung gestellten Datenbestandes und
    werden unter der Lizenz Creative Commons Namensnennung 3.0 Deutschland Lizenz (by-Nennung TextGrid, www.editura.de)
    (http://creativecommons.org/licenses/by/3.0/de/legalcode) wiederum zur Verfügung gestellt.-->
    <TEI xmlns="http://www.tei-c.org/ns/1.0"
         xmlns:tei="http://www.tei-c.org/ns/1.0"
         xmlns:xi="http://www.w3.org/2001/XInclude"
         xmlns:svg="http://www.w3.org/2000/svg"
         xmlns:math="http://www.w3.org/1998/Math/MathML">
       <teiHeader>
          <fileDesc>
             <titleStmt>
                <title>Title</title>
             </titleStmt>
             <publicationStmt>
                <p>Publication Information</p>
             </publicationStmt>
             <sourceDesc>
                <p>Information about the source</p>
             </sourceDesc>
          </fileDesc>
       </teiHeader>
       <text>
          <body>
             <div type="article">
                <head>Abel, Ambrosius</head>
                <div type="text">
                   <p>
                      <hi rend="bold">Abel, Ambrosius</hi>. Ambrosius Abel wurde am 1. Juni 1820 geboren</p>
                   <p rend="zenoCOLit">
                      <hi rend="italics">Quellen</hi>: Verlagskatalog 1887, Börsenblatt.</p>
                </div>
             </div>

             <div type="article">
                <head>Babenzien, Max</head>
                <div type="text">
                   <p>
                      <hi rend="bold">Babenzien, Max</hi>. Während das Gründungsjahr der Buchdruckerei in das Jahr 1816 fällt, ist die Buchhandlung von <hi rend="italics">A. Haase</hi> unter dessen Namen am 1. April 1833 gegründet.</p>
                   <p rend="zenoCOLit">
                      <hi rend="italics">Quellen</hi>: Verlagskatalog 1899.</p>
                </div>
             </div>
</body>
   </text>
</TEI>

Whenever I try to transform the xml file the XSL File transformation wouldnt perform. The XSL looks like this:

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

    <xsl:output method="text"/>
    <xsl:output method="xml" indent="yes" name="xml"/>




    <xsl:template match="/">
        <xsl:for-each select="//div[@type = 'article']">
            <xsl:variable name="filename"
                select="concat('ausgabedateien/',@type,'.xml')" />
            <xsl:value-of select="$filename" />  

            <xsl:result-document href="{$filename}_{position()}" format="xml" indent="yes">

                <TEI xmlns="http://www.tei-c.org/ns/1.0"
                    xmlns:tei="http://www.tei-c.org/ns/1.0"
                    xmlns:xi="http://www.w3.org/2001/XInclude"
                    xmlns:svg="http://www.w3.org/2000/svg"
                    xmlns:math="http://www.w3.org/1998/Math/MathML">
                    <teiHeader>
                        <fileDesc>
                            <titleStmt>
                                <title>Title</title>
                            </titleStmt>
                            <publicationStmt>
                                <p>Publication Information</p>
                            </publicationStmt>
                            <sourceDesc>
                                <p>Information about the source</p>
                            </sourceDesc>
                        </fileDesc>
                    </teiHeader>
                    <text>
                        <body>

                            <xsl:copy-of select="." />

                        </body>
                    </text>
                </TEI>

            </xsl:result-document>
        </xsl:for-each>
    </xsl:template>

</xsl:stylesheet>

I tried removing the xmlns Attribute of the xml file, everything would work properly. Anyone has a solution for this problem?

Michael Kay

Since you are using XSLT 2.0, you can add

xpath-default-namespace="http://www.tei-c.org/ns/1.0"

to the xsl:stylesheet element.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

XML and XSL transformation

From Dev

XSL transformation: Using translate and substring-after in XSL

From Dev

XML transformation with xsl - for each

From Dev

Read and substitute constants in XML during XSL transformation

From Dev

XSL transformation - how to look for linking node

From Dev

XSL transformation failed : Expected QName

From Dev

Using xsl string for xml file Transformation in Javascript

From Dev

XSL transformation - Namespace prefix undeclared

From Dev

PHP - Is it possible to transform XML file to XSL file using xslt transformation

From Dev

Create a transformation (XSL) to modify a heat (WiX) output

From Dev

Ordering nodes in XSL Transformation

From Dev

How do I give a argument to a XSL Transformation?

From Dev

XSL transformation failed to compile stylesheet

From Dev

XSL Transformation giving NaN for integers having "-" in between

From Dev

XSL Transformation with a variable in a XPATH string-comparison

From Dev

Worklight XSL transformation after getting response

From Dev

XSL Transformation not taking xml

From Dev

Read and substitute constants in XML during XSL transformation

From Dev

Unicode chars during XSL transformation

From Dev

Serious printing out of XSL transformation

From Dev

XSL transformation failed : Expected QName

From Dev

XSL transformation on Access export

From Dev

Read result of XSL Transformation with StAX in a streaming mode

From Dev

JAVA Transformation returns XSLT instead of transformation result

From Dev

append xml-stylesheet to xsl transformation result

From Dev

xsl transformation: rename a tag (for access)

From Dev

XSL transformation attributes to elements

From Dev

Performing XSL Transformation in VSTS

From Dev

Lookup directory for Saxon XSL transformation

Related Related

  1. 1

    XML and XSL transformation

  2. 2

    XSL transformation: Using translate and substring-after in XSL

  3. 3

    XML transformation with xsl - for each

  4. 4

    Read and substitute constants in XML during XSL transformation

  5. 5

    XSL transformation - how to look for linking node

  6. 6

    XSL transformation failed : Expected QName

  7. 7

    Using xsl string for xml file Transformation in Javascript

  8. 8

    XSL transformation - Namespace prefix undeclared

  9. 9

    PHP - Is it possible to transform XML file to XSL file using xslt transformation

  10. 10

    Create a transformation (XSL) to modify a heat (WiX) output

  11. 11

    Ordering nodes in XSL Transformation

  12. 12

    How do I give a argument to a XSL Transformation?

  13. 13

    XSL transformation failed to compile stylesheet

  14. 14

    XSL Transformation giving NaN for integers having "-" in between

  15. 15

    XSL Transformation with a variable in a XPATH string-comparison

  16. 16

    Worklight XSL transformation after getting response

  17. 17

    XSL Transformation not taking xml

  18. 18

    Read and substitute constants in XML during XSL transformation

  19. 19

    Unicode chars during XSL transformation

  20. 20

    Serious printing out of XSL transformation

  21. 21

    XSL transformation failed : Expected QName

  22. 22

    XSL transformation on Access export

  23. 23

    Read result of XSL Transformation with StAX in a streaming mode

  24. 24

    JAVA Transformation returns XSLT instead of transformation result

  25. 25

    append xml-stylesheet to xsl transformation result

  26. 26

    xsl transformation: rename a tag (for access)

  27. 27

    XSL transformation attributes to elements

  28. 28

    Performing XSL Transformation in VSTS

  29. 29

    Lookup directory for Saxon XSL transformation

HotTag

Archive