Is this XSLT correct for the XML file which I have developed?

Posted by atrueguy on Stack Overflow See other posts from Stack Overflow or by atrueguy
Published on 2010-05-21T02:31:52Z Indexed on 2010/05/21 2:40 UTC
Read the original article Hit count: 253

Filed under:
|

This is my XML file. I need to develop a xslt for this.

<?xml version="1.0" encoding="ISO-8859-1"?>
<!--<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">-->
<!-- Generator: Arbortext IsoDraw 7.0 -->
<svg width="100%" height="100%" viewBox="0 0 214.819 278.002">
    <g id="Standard_x0020_layer"/>
    <g id="Catalog">
        <line stroke-width="0.353" stroke-linecap="butt" x1="5.839" y1="262.185" x2="209.039" y2="262.185"/>
        <text transform="matrix(0.984 0 0 0.93 183.515 265.271)" stroke="none" fill="#000000" font-family="'Helvetica'" font-size="3.174">© 2009 k Co.</text>
        <text transform="matrix(0.994 0 0 0.93 7.235 265.3)" stroke="none" fill="#000000" font-family="'Helvetica'" font-size="3.174">087156-8-</text>
        <text transform="matrix(0.995 0 0 0.93 21.708 265.357)" stroke="none" fill="#000000" font-family="'Helvetica'" font-size="3.174" font-weight="bold">AB</text>
        <path stroke-width="0.088" stroke-linecap="butt" stroke-dasharray="2.822 1.058" d="M162.037 107.578L174.439 100.417L180.698 104.03"/>
        <g id="AUTOID_20445" class="52971">
            <line stroke-width="0.088" stroke-linecap="butt" x1="68.859" y1="43.621" x2="65.643" y2="45.399"/>
            <text transform="matrix(0.944 0 0 0.93 69.165 43.356)" stroke="none" fill="#000000" font-family="'Helvetica'" font-size="2.775" font-weight="bold">52971</text>
        </g>
    </g>
</svg>

I have developed a XSLT for this in this way, but I am failing to produce the desired output can any one help me in this.

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:svg="http://www.w3.org/2000/svg">
    <xsl:template match="/">
        <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
            <fo:layout-master-set>
                <fo:simple-page-master master-name="simple" page-height="11in" page-width="8.5in">
                    <fo:region-body margin="0.7in" margin-top="1.15in" margin-left=".8in"/>
                    <fo:region-before extent="1.5in"/>
                    <fo:region-after extent="1.5in"/>
                    <fo:region-start extent="1.5in"/>
                    <fo:region-end extent="1.5in"/>
                </fo:simple-page-master>
            </fo:layout-master-set>
            <fo:page-sequence master-reference="simple">
                <fo:flow flow-name="xsl-region-body">
                    <fo:block>
                        <fo:instream-foreign-object>
                            <svg:svg xmlns:svg="http://www.w3.org/2000/svg" height="100%" width="100%" viewBox="0 0 214.819 278.002">
                                <xsl:for-each select="svg/g">
                                    <svg:g style="stroke:none;fill:#000000;">
                                        <svg:path>
                                            <xsl:variable name="s">
                                                <xsl:value-of select="translate(@d,' ','')"/>
                                            </xsl:variable>
                                            <xsl:attribute name="d"><xsl:value-of select="translate($s,',',' ')"/></xsl:attribute>
                                        </svg:path>
                                    </svg:g>
                                </xsl:for-each>
                                <xsl:for-each select="svg/g">
                                    <svg:line 
                                        x1 = "{$x1}"
                                        y1 = "{$y1}"
                                        x2 = "{$x2}"
                                        y2 = "{$y2}"
                                        style = "stroke-width: 0.088; stroke: black;"/>
                                        <line xmlns="http://www.w3.org/2000/svg" x1="{$x1}" y1="{$y1}" x2="{$x2}" y2="{$y2}" stroke-width="0.088" stroke="black" fill="#000000" />
                                </xsl:for-each>
                            </svg:svg>
                        </fo:instream-foreign-object>
                    </fo:block>
                </fo:flow>
            </fo:page-sequence>
        </fo:root>
    </xsl:template>
</xsl:stylesheet>

Please help me in this

© Stack Overflow or respective owner

Related posts about xslt

Related posts about Xml