zme1 / toscana

A repository to house research and web development for the Lega Toscana project, led by professor Lina Insana (Spring 2018) and professor Lorraine Denman (Fall 2018), and with consultation from members of the DH Advanced Praxis group at the University of Pittsburgh at Greensburg.
http://toscana.newtfire.org
3 stars 1 forks source link

SVG #24

Closed zme1 closed 6 years ago

zme1 commented 6 years ago

I have no idea why my SVG is not rendering properly here. All I'm trying to do is make a normal x and y axis, but the program won't cooperate. My code is below:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.w3.org/1999/html"
    exclude-result-prefixes="xs" version="3.0">
    <xsl:output method="xml" indent="yes" doctype-system="about:legacy-compat"/>
    <xsl:template match="/">
        <html>
            <head>
                <title>AH</title>
            </head>
            <body>
                <svg xmlns="http://www.w3.org/2000/svg">
                    <g transform="translate(20,600)">
                        <line x1="0" y1="0" x2="1000" y2="0" stroke="black" stroke-width="2"/>
                    </g>
                </svg>
            </body>
        </html>
    </xsl:template>

</xsl:stylesheet>

The line does render, but it's only visible when I give the line a monstrously huge stroke-width value. I have not a clue why it's not cooperating with me... @djbpitt @ebeshero Am I missing something obvious here?

zme1 commented 6 years ago

@djbpitt @ebeshero I changed all the namespace declarations so that I'm just generating SVG on it's own, and that fixed it...

ebeshero commented 6 years ago

@zme1 Great! I am glad you remembered the old adage, “it’s always a namespace issue”. But you can output SVG within HTML, and I think you just need to include more namespaces for the output up in the <xsl:stylesheet> element, and they need to be prefixed, just as you see the xmlns:xs definition for XMLSchema included by default there . (I bet I can find an example lying around In our files somewhere...)

If you are pulling data from your TEI files, you will need to set an xpath-default-namespace to the TEI namespace.