Announcement

Collapse
No announcement yet.

<xsl:output method="xml" indent="no"/>

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

  • <xsl:output method="xml" indent="no"/>

    Hallo,

    ich habe da ein Problem mit dem Attribut indent. Ich will in meiner Ausgabedatei keine Zeilenumbrüche haben. Das sollte doch damit machbar sein?

    So nun komme ich aber leider nicht zu dem gewünschten Ergebnis.
    Der Anfang des Dokumentes ist korrekt.
    ?xml version="1.0" encoding="UTF-8"?><html><head><title>2.2.1 The Codex Alimentarius Commission within the UN-System 1 / 2</title>
    Also schön eins nach dem Anderen.

    Aber mitten im Dokument hört er damit auf und schreibt es so in die Ausgabe:
    <span class="ec_">the </span>
    <a class="ec_link" href="http://www.un.org/documents/st.htm">Secretariat</a>
    <span class="ec_">.</span>

    Was kann ich da machen? Woran kann das liegen? Bei Bedarf kann auch die ganzen Stylesheets veröffentlichen, aber das sind ne Menge auf dem Weg bis zum Endergebnis.

    Gruß


    EDIT:

    Ich denke es ist vielleicht ganz hilfreich das komplette Resultat der Transformation zu sehen.

    <?xml version="1.0" encoding="UTF-8"?><html><head><title>Module International legislation on consumer protection and food</title><meta http-equiv="content-type" content="text/xhtml; charset=utf-8"/><script src="scripts/SCOFunctions.js" type="text/javascript"/><style type="text/css">
    @import url("css/style_eCampus_oe_eng.css");

    @import url("css/style_eCampus.css");
    </style></head><body onload="startLM()" onunload="save('index.html')"><div id="holder"><div id="header"><div id="menu"><a href="index.html" id="startseite"><i>Startseite</i></a><a href="singlefile.html" id="druckversion"><i>Druckversion</i></a><a href="w0001.html" id="weiter"><i>Weiter</i></a></div></div><div id="lesson"><p><a class="ec_header1" href="index.html">Module International legislation on consumer protection and food</a></p><p><a class="ec_header2" href="w0001.html">1. Introduction </a></p><p><a class="ec_header2" href="w0005.html">2: International Law</a></p><p><a class="ec_header3" href="w0006.html">2.1 Basics of International Law</a></p><p><a class="ec_header3" href="w0007.html">2.1.1 Characterising International Law</a></p><p><a class="ec_header3" href="w0008.html">2.1.2 Subject of International Law: States and International Organisations</a></p><p><a class="ec_header3" href="w0009.html">2.1.3 Sources of International Law</a></p><p><a class="ec_header3" href="w0010.html">2.1.4 Consequences of breaches of International Law</a></p><p><a class="ec_header3" href="w0011.html">2.2. International Organisations with relevance to food trade</a></p><p><a class="ec_header3" href="w0012.html"/></p><p><a class="ec_header3" href="w0013.html">2.2.1 The Codex Alimentarius Commission within the UN-System</a></p><p><a class="ec_header3" href="w0015.html">2.2.1.1 United Nations Commission on International Trade Law (UNCITRAL) and CISG</a></p><p><a class="ec_header3" href="w0016.html">2.2.1.2 The Codex Alimentarius Commission (CAC) within the Food and Agricultural Organisation (FAO) and the World Health Organisation (WHO)</a></p><p><a class="ec_header3" href="w0022.html">2.2.2 The World Trade Organisation (WTO) </a></p><p><a class="ec_header3" href="w0024.html">2.2.2.1 WTO agreements applicable on food trade</a></p><p><a class="ec_header3" href="w0026.html">2.2.2.2 The WTO use of the Codex as reference for legal international standards</a></p><p><a class="ec_header3" href="w0027.html">2.2.2.3 The WTO dispute settlement scheme</a></p><p><a class="ec_header3" href="w0029.html">2.2.3 Bilateral and regional agreements </a></p><p><a class="ec_header3" href="w0032.html">2.2.4 Final exercises and answers to text exercises</a></p><p><a class="ec_header3" href="w0033.html">2.2.4.1Final exercise 1</a></p><p><a class="ec_header3" href="w0034.html">2.2.4.2 Final exercise 2</a></p><p><a class="ec_header3" href="w0035.html">2.2.4.3 Final exercise 3</a></p><p><a class="ec_header3" href="w0036.html">2.2.4.4 Answers to text exercises</a></p><p><a class="ec_header2" href="w0039.html">Chapter 3</a></p><p><a class="ec_header2" href="w0040.html">3. Basics of the Law of the European Union </a></p><p><a class="ec_header3" href="w0041.html">3.1 EU and EC</a></p><p><a class="ec_header3" href="w0046.html">3.2 Institutions of EU and EC relevant for food and consumer protection</a></p><p><a class="ec_header3" href="w0047.html">3.2.1 European Council</a></p><p><a class="ec_header3" href="w0048.html">3.2.2 European Commission</a></p><p><a class="ec_header3" href="w0050.html">3.2.3 Council of the European Union</a></p><p><a class="ec_header3" href="w0051.html">3.2.4 European Parliament</a></p><p><a class="ec_header3" href="w0052.html">3.2.5 European Court of Justice</a></p><p><a class="ec_header3" href="w0054.html">3.2.6 European Food Safety Agency</a></p><p><a class="ec_header3" href="w0055.html">3.3 EC-Law</a></p><p><a class="ec_header3" href="w0057.html">3.4 Relation to the law of the member states</a></p><p><a class="ec_header3" href="w0060.html">3.4 Final exercises</a></p><p><a class="ec_header2" href="w0061.html">Chapter 4</a></p><p><a class="ec_header2" href="w0062.html">4. EC internal market</a></p><p><a class="ec_header3" href="w0063.html">4.1 Customs Union</a></p><p><a class="ec_header3" href="w0064.html">4.2 Harmonisation</a></p><p><a class="ec_header3" href="w0065.html">4.2.1 The Common Agricultural Policy (CAP)</a></p><p><a class="ec_header3" href="w0066.html">4.2.2 Harmonisation of food safety regulation</a></p><p><a class="ec_header3" href="w0067.html">4.2.2.1 Free movement of “goods”</a></p><p><a class="ec_header3" href="w0068.html">4.2.2.2 Legal stages of harmonising food law</a></p><p><a class="ec_header3" href="w0069.html">4.2.2.3 Overview to the contents of harmonised food law</a></p><p><a class="ec_header3" href="w0070.html">4.3 Free trade of goods</a></p><p><a class="ec_header3" href="w0071.html">4.3.1 State measures having an equivalent effect to quantitative restrictions</a></p><p><a class="ec_header3" href="w0072.html">4.3.1.1 Dassonville-formula</a></p><p><a class="ec_header3" href="w0073.html">4.3.1.2 Trading rules enacted by member states</a></p><p><a class="ec_header3" href="w0074.html">4.3.1.3. Keck: Good requirement or selling arrangement?</a></p><p><a class="ec_header3" href="w0075.html">4.3.2 Cassis: Mutual recognition</a></p><p><a class="ec_header3" href="w0076.html">4.3.3 Justifications</a></p><p><a class="ec_header3" href="w0077.html">4.3.3.1 Grounds mentioned in Art. 30 EC-Treaty</a></p><p><a class="ec_header3" href="w0078.html">4.3.3.2 Cassis: Mandatory requirements</a></p><p><a class="ec_header3" href="w0079.html">4.3.4 Result</a></p><p><a class="ec_header3" href="w0080.html">4.4 Final exercises and answers to text exercises</a></p><p><a class="ec_header2" href="w0081.html">5. EU Consumer Law</a></p><p><a class="ec_header3" href="w0082.html">5.1 Introduction</a></p><p><a class="ec_header3" href="w0083.html">5.2 Developments</a></p><p><a class="ec_header3" href="w0084.html">5.2.1 Indirect consumer protection</a></p><p><a class="ec_header3" href="w0085.html">5.2.2 Consumer protection as a policy field of its own</a></p><p><a class="ec_header3" href="w0086.html">5.3 Organising consumer interests</a></p><p><a class="ec_header3" href="w0087.html">5.4 Consumer affairs as a major political issue</a></p><p><a class="ec_header3" href="w0088.html">5.4.1 Rejection of the treaty of Maastricht and of the Constititution </a></p><p><a class="ec_header3" href="w0089.html">5.4.2 Scandals </a></p><p><a class="ec_header3" href="w0090.html">5.5 Actual scope of consumer law </a></p><p><a class="ec_header3" href="w0091.html">5.6 Examples</a></p><p><a class="ec_header3" href="w0092.html">5.6.1 Distance contracts</a></p><p><a class="ec_header3" href="w0093.html">5.6.2 Product liability</a></p><p><a class="ec_header3" href="w0094.html">5.6.3 CE-conformity marking </a></p><p><a class="ec_header3" href="w0095.html">5.7 Final exercises and answers to text exercises</a></p><p><a class="ec_header2" href="w0096.html">Literature</a></p></div><div class="ec_header_m">Module International legislation on consumer protection and food</div><div id="content"><div><a href="media/pictures/10000000000002000000018005B2B336.png"><img class="ec_image" alt="" src="media/pictures/10000000000002000000018005B2B336.png"/></a><p class="ec_subtitle"/></div><p class="ec_p">
    <span class="ec_pcdata">Parts: </span>
    </p><ul class="ec_ul_list">
    <li class="ec_ul_listitem"><p class="ec_p">
    <span class="ec_pcdata">Basics of International Food Law</span>
    </p></li>
    <li class="ec_ul_listitem"><p class="ec_p">
    <span class="ec_pcdata">key institutions and related administrative bodies in the EU </span>
    </p></li>
    <li class="ec_ul_listitem"><p class="ec_p">
    <span class="ec_pcdata">barriers to the free flow of goods across national boundaries </span>
    </p></li>
    <li class="ec_ul_listitem"><p class="ec_p">
    <span class="ec_pcdata">EU Consumer Law</span>
    </p></li>
    </ul> </div><div id="footer"><a href="w0001.html" id="weiter_footer"><i>Weiter</i></a></div></div></body></html>
    Zuletzt editiert von michael84; 05.02.2008, 14:08. Reason: Informationen hinzugefügt.

  • #2
    Könnte sein, dass im Ausgangs-XML-Dokument Zeilenumbrüche, Tabs und sonstiger Leerraum in Elementinhalten steht und mittransformiert wird. Hier sollte die Funktion normalize-space() an geeigneten Stellen helfen.

    Comment


    • #3
      Hallo Thomas,

      das Problem sind nicht die Leerzeichen innerhalb der Elemente.
      Das Problem ist zum Beispiel:
      <Element>Inhalt
      <NochEinElement>.</NochEinElement>
      </Element>

      So im Browser habe ich als Ergebnis dann ein Leerzeichen, wo garkeins sein soll. Da der Zeilenumbruch falsch interpretiert wird und aus mehreren Leerzeichen ein einziges gemacht wird.

      Gruß

      Comment


      • #4
        Genau diesen Zeilenumbruch eliminiert normalize-space().

        Comment


        • #5
          Hallo,

          okay du hast recht mit dem was du sagst :-)
          Es werden dabei die Leerzeichen am Anfag und am Ende auf eins reduziert.

          Sorry, mein Fehler... habe bei dem Beispiel nicht so recht aufgepasst.
          Das sollte mein Problem besser verdeutlichen:
          <a class="ec_link" href="http://www.un.org/documents/st.htm">Secretariat</a>
          <span class="ec_">.</span>

          Hierbei wird normalize-space() denke ich nicht das gewünschte Ergebnis liefern. Es geht ja nicht um den Inhalt einzelner Elemente sondern...

          Gruß

          Comment


          • #6
            Sieht der Code vorher oder nachher so aus? Was soll denn konkret herauskommen?

            BTW: normalize-space() entfernt führenden bzw. abschließenden Leerraum komplett (aka trim bzw. ltrim und rtrim) und reduziert innerhalb des Inhaltes auf jeweils ein Leerzeichen!

            Beispiel:
            Code:
            <xsl:variable name="bla" select="'    a     b     c    '"/>
            <xsl:value-of select="normalize-space($bla)"/><!--a b c-->

            Comment


            • #7
              hallo,

              so bin wieder da
              also es kommt ja folgendes raus:
              <a class="ec_link" href="http://www.un.org/documents/st.htm">Secretariat</a>
              <span class="ec_">.</span>

              es soll aber <a class="ec_link" href="http://www.un.org/documents/st.htm">Secretariat</a><span class="ec_">.</span>
              rauskommen.

              Also zw. den Elementen soll kein Leerzeichen oder Zeilenumbruch oder sowas sein.

              Werde es nachher mit normalize-space ausprobieren. mal schauen obs hilft.

              na ja, also das ist jedenfalls nicht die gewünschte lösung. denn es werden wie schon gesagt ja auch die leerzeichen im inhalt entfernt. also auch leerzeichen, die gewollt sind. kann mir da jemand helfen!?
              Zuletzt editiert von michael84; 12.02.2008, 14:18.

              Comment


              • #8
                Du hast noch immer nichts Genaues über die Ausgangsstruktur gesagt.

                Comment


                • #9
                  Hallo,
                  okay dann nun die Ausgansstruktur:

                  ...
                  <ec kind="text">
                  ...
                  <ec:special kind="text">the </ec:special>
                  <ec:special kind="link" url="http://www.un.org/documents/st.htm">Secretariat</ec:special>
                  <ec:special kind="text">.</ec:special>
                  ...
                  </ec>
                  ...

                  Das ganze Dokument kann ich hier der Größe wegen nicht posten. Ich denke aber dies sollte reichen. Das ist der Ausschnitt, auf den ich mich im letzten Beitrag auch beziehe.

                  Comment


                  • #10
                    Naja, so langsam kommen wir ja zur Sache. Hier mal ein Versuch mit diesem Test-XML-Code (die Smileys sollen wohl darstellen):
                    Code:
                    <?xml version="1.0" encoding="ISO-8859-1"?>
                    <wurzel xmlns:ec="http://example.net/ec">
                      <ec:p kind="text">
                        <ec:special kind="text">the </ec:special>
                        <ec:special kind="link" url="http://www.un.org/documents/st.htm">Secretariat</ec:special>
                        <ec:special kind="text">.</ec:special>
                      </ec:p>
                    </wurzel>
                    Transformation:
                    Code:
                    <?xml version="1.0" encoding="ISO-8859-1"?>
                    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                      xmlns:ec="http://example.net/ec" exclude-result-prefixes="ec"
                      xmlns="http://www.w3.org/1999/xhtml">
                        
                      <xsl:output method="xml" version="1.0" encoding="ISO-8859-1" indent="no"/>
                    
                      <xsl:template match="wurzel">
                        <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
                          <head><title>Test</title></head>
                          <body>
                            <xsl:apply-templates select="ec:p"/>
                          </body>
                        </html>
                      </xsl:template>
                    
                      <xsl:template match="ec:p">
                        <xsl:apply-templates select="ec:special"/>
                      </xsl:template>
                    
                      <xsl:template match="ec:special[@kind='text']">
                        <span class="ec_"><xsl:value-of select="."/></span>
                      </xsl:template>
                    
                      <xsl:template match="ec:special[@kind='link']">
                        <a href="{@url}"><xsl:value-of select="."/></a>
                      </xsl:template>
                    
                    </xsl:stylesheet>
                    Saxon 9.0-Output:

                    Code:
                    
                    	
                    	
                    	
                    
                    
                    HTML Code:
                    <?xml version="1.0" encoding="ISO-8859-1"?><html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><title>Test</title></head><body><span class="ec_">the </span><a href="http://www.un.org/documents/st.htm">Secretariat</a><span class="ec_">.</span></body></html>
                    Es erscheint offenbar alles wie gewünscht ohne Umbrüche. Keine Ahnung, was Du mit Deinem Prozessor anstellst ;-) Vermeide Umbrüche im Stylesheet, also hier speziell <span>...</span> in einer Zeile belassen.

                    Comment


                    • #11
                      Hallo,

                      naja... ist halt immer doof,was angefangenes weiter zu führen. Da kennt man sich nicht immer 100%ig aus. Habe den Fehler nun gefunden, auch wenn es sich mir nicht wirklich erschließt, warum es nun geht.

                      Also ganz am Anfang steht n Open Office Dokument. (indent="no")
                      Danach kam ein Zwischenformat. (indent="yes", was oben auch als Ausgangssituation steht)
                      Und am Ende sollte es ja indent="no" sein. Habe es nun im Zwischenformat auf no gesetzt und nun kommt auch das gewünschte Ergebnis raus.

                      Wieso? Keine Ahnung, wo da der genaue Unterschied jetzt ist.

                      Comment

                      Working...
                      X