TEI-XML dictionary to simple HTML table using XSL











up vote
0
down vote

favorite












Need to put "entryFree" words in a first column (leaving <form> content for second), and "sense" and other as a second, every pair in the same row, with borders. Sample XSL stylesheet contains formatting only.



sample XML: https://drive.google.com/file/d/1sNAbWw5xo1pgwK2QfQwPrbZtZt8uV48T/view?usp=sharing



fancy XSL (licence permits modification): https://github.com/michmech/tei-dictionary.xsl










share|improve this question




























    up vote
    0
    down vote

    favorite












    Need to put "entryFree" words in a first column (leaving <form> content for second), and "sense" and other as a second, every pair in the same row, with borders. Sample XSL stylesheet contains formatting only.



    sample XML: https://drive.google.com/file/d/1sNAbWw5xo1pgwK2QfQwPrbZtZt8uV48T/view?usp=sharing



    fancy XSL (licence permits modification): https://github.com/michmech/tei-dictionary.xsl










    share|improve this question


























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      Need to put "entryFree" words in a first column (leaving <form> content for second), and "sense" and other as a second, every pair in the same row, with borders. Sample XSL stylesheet contains formatting only.



      sample XML: https://drive.google.com/file/d/1sNAbWw5xo1pgwK2QfQwPrbZtZt8uV48T/view?usp=sharing



      fancy XSL (licence permits modification): https://github.com/michmech/tei-dictionary.xsl










      share|improve this question















      Need to put "entryFree" words in a first column (leaving <form> content for second), and "sense" and other as a second, every pair in the same row, with borders. Sample XSL stylesheet contains formatting only.



      sample XML: https://drive.google.com/file/d/1sNAbWw5xo1pgwK2QfQwPrbZtZt8uV48T/view?usp=sharing



      fancy XSL (licence permits modification): https://github.com/michmech/tei-dictionary.xsl







      xml xslt tei






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 17 at 15:17

























      asked Nov 17 at 13:51









      Rimdar

      32




      32
























          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote



          accepted










          If you want to map all entryFree elements to HTML table rows (i.e. HTML tr elements in an HTML table) then set up the table as needed and in a tbody process all entryFree elements, mapping them with a template to a tr:



          <xsl:output method="html" doctype-system="about:legacy-doctype"/>

          <xsl:template match="/">
          <html>
          <head>
          <title>Test</title>
          </head>
          <body>
          <h1>Table</h1>
          <table>
          <thead>
          <tr>
          <th>free entry</th>
          <th>forms/senses</th>
          </tr>
          </thead>
          <tbody>
          <xsl:apply-templates select="//tei:entryFree"/>
          </tbody>
          </table>
          </body>
          </html>
          </xsl:template>

          <xsl:template match="tei:entryFree">
          <tr>
          <td>
          <xsl:value-of select="@sortKey"/>
          </td>
          <td>
          <xsl:apply-templates/>
          </td>
          </tr>
          </xsl:template>


          You will need to remove the template matching tei:entryFree obviously.



          As for formatting the table, that is a HTML/CSS problem, HTML 4 https://www.w3.org/TR/html401/struct/tables.html#h-11.3.1 allows e.g.



                      <table rules="all" frame="border">
          <thead>
          <tr>
          <th>free entry</th>
          <th>forms/senses</th>
          </tr>
          </thead>
          <tbody>
          <xsl:apply-templates select="//tei:entryFree"/>
          </tbody>
          </table>


          in HTML5 I think using CSS is preferred:



          <xsl:template match="/">
          <html>
          <head>
          <title>Test</title>
          <style>
          table.dict {
          border: 1px solid black;
          border-collapse: collapse;
          }
          table.dict th, table.dict td {
          border: 1px solid black;
          }
          </style>
          </head>
          <body>
          <h1>Table</h1>
          <table class="dict">
          <thead>
          <tr>
          <th>free entry</th>
          <th>forms/senses</th>
          </tr>
          </thead>
          <tbody>
          <xsl:apply-templates select="//tei:entryFree"/>
          </tbody>
          </table>
          </body>
          </html>
          </xsl:template>





          share|improve this answer





















            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53351850%2ftei-xml-dictionary-to-simple-html-table-using-xsl%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            0
            down vote



            accepted










            If you want to map all entryFree elements to HTML table rows (i.e. HTML tr elements in an HTML table) then set up the table as needed and in a tbody process all entryFree elements, mapping them with a template to a tr:



            <xsl:output method="html" doctype-system="about:legacy-doctype"/>

            <xsl:template match="/">
            <html>
            <head>
            <title>Test</title>
            </head>
            <body>
            <h1>Table</h1>
            <table>
            <thead>
            <tr>
            <th>free entry</th>
            <th>forms/senses</th>
            </tr>
            </thead>
            <tbody>
            <xsl:apply-templates select="//tei:entryFree"/>
            </tbody>
            </table>
            </body>
            </html>
            </xsl:template>

            <xsl:template match="tei:entryFree">
            <tr>
            <td>
            <xsl:value-of select="@sortKey"/>
            </td>
            <td>
            <xsl:apply-templates/>
            </td>
            </tr>
            </xsl:template>


            You will need to remove the template matching tei:entryFree obviously.



            As for formatting the table, that is a HTML/CSS problem, HTML 4 https://www.w3.org/TR/html401/struct/tables.html#h-11.3.1 allows e.g.



                        <table rules="all" frame="border">
            <thead>
            <tr>
            <th>free entry</th>
            <th>forms/senses</th>
            </tr>
            </thead>
            <tbody>
            <xsl:apply-templates select="//tei:entryFree"/>
            </tbody>
            </table>


            in HTML5 I think using CSS is preferred:



            <xsl:template match="/">
            <html>
            <head>
            <title>Test</title>
            <style>
            table.dict {
            border: 1px solid black;
            border-collapse: collapse;
            }
            table.dict th, table.dict td {
            border: 1px solid black;
            }
            </style>
            </head>
            <body>
            <h1>Table</h1>
            <table class="dict">
            <thead>
            <tr>
            <th>free entry</th>
            <th>forms/senses</th>
            </tr>
            </thead>
            <tbody>
            <xsl:apply-templates select="//tei:entryFree"/>
            </tbody>
            </table>
            </body>
            </html>
            </xsl:template>





            share|improve this answer

























              up vote
              0
              down vote



              accepted










              If you want to map all entryFree elements to HTML table rows (i.e. HTML tr elements in an HTML table) then set up the table as needed and in a tbody process all entryFree elements, mapping them with a template to a tr:



              <xsl:output method="html" doctype-system="about:legacy-doctype"/>

              <xsl:template match="/">
              <html>
              <head>
              <title>Test</title>
              </head>
              <body>
              <h1>Table</h1>
              <table>
              <thead>
              <tr>
              <th>free entry</th>
              <th>forms/senses</th>
              </tr>
              </thead>
              <tbody>
              <xsl:apply-templates select="//tei:entryFree"/>
              </tbody>
              </table>
              </body>
              </html>
              </xsl:template>

              <xsl:template match="tei:entryFree">
              <tr>
              <td>
              <xsl:value-of select="@sortKey"/>
              </td>
              <td>
              <xsl:apply-templates/>
              </td>
              </tr>
              </xsl:template>


              You will need to remove the template matching tei:entryFree obviously.



              As for formatting the table, that is a HTML/CSS problem, HTML 4 https://www.w3.org/TR/html401/struct/tables.html#h-11.3.1 allows e.g.



                          <table rules="all" frame="border">
              <thead>
              <tr>
              <th>free entry</th>
              <th>forms/senses</th>
              </tr>
              </thead>
              <tbody>
              <xsl:apply-templates select="//tei:entryFree"/>
              </tbody>
              </table>


              in HTML5 I think using CSS is preferred:



              <xsl:template match="/">
              <html>
              <head>
              <title>Test</title>
              <style>
              table.dict {
              border: 1px solid black;
              border-collapse: collapse;
              }
              table.dict th, table.dict td {
              border: 1px solid black;
              }
              </style>
              </head>
              <body>
              <h1>Table</h1>
              <table class="dict">
              <thead>
              <tr>
              <th>free entry</th>
              <th>forms/senses</th>
              </tr>
              </thead>
              <tbody>
              <xsl:apply-templates select="//tei:entryFree"/>
              </tbody>
              </table>
              </body>
              </html>
              </xsl:template>





              share|improve this answer























                up vote
                0
                down vote



                accepted







                up vote
                0
                down vote



                accepted






                If you want to map all entryFree elements to HTML table rows (i.e. HTML tr elements in an HTML table) then set up the table as needed and in a tbody process all entryFree elements, mapping them with a template to a tr:



                <xsl:output method="html" doctype-system="about:legacy-doctype"/>

                <xsl:template match="/">
                <html>
                <head>
                <title>Test</title>
                </head>
                <body>
                <h1>Table</h1>
                <table>
                <thead>
                <tr>
                <th>free entry</th>
                <th>forms/senses</th>
                </tr>
                </thead>
                <tbody>
                <xsl:apply-templates select="//tei:entryFree"/>
                </tbody>
                </table>
                </body>
                </html>
                </xsl:template>

                <xsl:template match="tei:entryFree">
                <tr>
                <td>
                <xsl:value-of select="@sortKey"/>
                </td>
                <td>
                <xsl:apply-templates/>
                </td>
                </tr>
                </xsl:template>


                You will need to remove the template matching tei:entryFree obviously.



                As for formatting the table, that is a HTML/CSS problem, HTML 4 https://www.w3.org/TR/html401/struct/tables.html#h-11.3.1 allows e.g.



                            <table rules="all" frame="border">
                <thead>
                <tr>
                <th>free entry</th>
                <th>forms/senses</th>
                </tr>
                </thead>
                <tbody>
                <xsl:apply-templates select="//tei:entryFree"/>
                </tbody>
                </table>


                in HTML5 I think using CSS is preferred:



                <xsl:template match="/">
                <html>
                <head>
                <title>Test</title>
                <style>
                table.dict {
                border: 1px solid black;
                border-collapse: collapse;
                }
                table.dict th, table.dict td {
                border: 1px solid black;
                }
                </style>
                </head>
                <body>
                <h1>Table</h1>
                <table class="dict">
                <thead>
                <tr>
                <th>free entry</th>
                <th>forms/senses</th>
                </tr>
                </thead>
                <tbody>
                <xsl:apply-templates select="//tei:entryFree"/>
                </tbody>
                </table>
                </body>
                </html>
                </xsl:template>





                share|improve this answer












                If you want to map all entryFree elements to HTML table rows (i.e. HTML tr elements in an HTML table) then set up the table as needed and in a tbody process all entryFree elements, mapping them with a template to a tr:



                <xsl:output method="html" doctype-system="about:legacy-doctype"/>

                <xsl:template match="/">
                <html>
                <head>
                <title>Test</title>
                </head>
                <body>
                <h1>Table</h1>
                <table>
                <thead>
                <tr>
                <th>free entry</th>
                <th>forms/senses</th>
                </tr>
                </thead>
                <tbody>
                <xsl:apply-templates select="//tei:entryFree"/>
                </tbody>
                </table>
                </body>
                </html>
                </xsl:template>

                <xsl:template match="tei:entryFree">
                <tr>
                <td>
                <xsl:value-of select="@sortKey"/>
                </td>
                <td>
                <xsl:apply-templates/>
                </td>
                </tr>
                </xsl:template>


                You will need to remove the template matching tei:entryFree obviously.



                As for formatting the table, that is a HTML/CSS problem, HTML 4 https://www.w3.org/TR/html401/struct/tables.html#h-11.3.1 allows e.g.



                            <table rules="all" frame="border">
                <thead>
                <tr>
                <th>free entry</th>
                <th>forms/senses</th>
                </tr>
                </thead>
                <tbody>
                <xsl:apply-templates select="//tei:entryFree"/>
                </tbody>
                </table>


                in HTML5 I think using CSS is preferred:



                <xsl:template match="/">
                <html>
                <head>
                <title>Test</title>
                <style>
                table.dict {
                border: 1px solid black;
                border-collapse: collapse;
                }
                table.dict th, table.dict td {
                border: 1px solid black;
                }
                </style>
                </head>
                <body>
                <h1>Table</h1>
                <table class="dict">
                <thead>
                <tr>
                <th>free entry</th>
                <th>forms/senses</th>
                </tr>
                </thead>
                <tbody>
                <xsl:apply-templates select="//tei:entryFree"/>
                </tbody>
                </table>
                </body>
                </html>
                </xsl:template>






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 20 at 9:12









                Martin Honnen

                110k65876




                110k65876






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.





                    Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                    Please pay close attention to the following guidance:


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53351850%2ftei-xml-dictionary-to-simple-html-table-using-xsl%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    404 Error Contact Form 7 ajax form submitting

                    How to know if a Active Directory user can login interactively

                    TypeError: fit_transform() missing 1 required positional argument: 'X'