Jump to content

cyanoboy

Members
  • Content Count

    7
  • Joined

  • Last visited

Community Reputation

1 Neutral

About cyanoboy

  • Rank
    Newbie

Profile Information

  • Location
    Italy
  1. I found it...using the starts-with function! <xsl:for-each select="svg:svg/svg:image[starts-with(@id, 'a')]"> Now...next problem! There is a way to create a variable and set it's name dinamically?For example: <xsl:for-each select="@*[starts-with(name(.),'x')]"> <xsl:variable name="name(.)" select="0" /></xsl:for-each> I tried but it's not a good syntax!
  2. I know that, but I must do this work for a university exam..I'm trying little by little to create the xslt...Now I've this problem...I need to do a for-each cycle, selecting node with attributes that begin with a certain letter..I tried to do <xsl:for-each select="svg:svg/svg:image[@id='a'*]">, but is incorrect..i tried also <xsl:for-each select="svg:svg/svg:image[@id=a*]">, but nothing..What's the right expression?
  3. Ok, I come back here after a while..In the script tag of the svg file I've the javascript code logic (the svg file it's a slot machine game) surrounded by CDATA tag.I need to copy the inside of the CDATA tag (obviously the javascript code) to html5 script tag (without CDATA tag).I also need to modify the javascript code to fit in calls to canvas context API..Practically the xslt must copy the javascript code and, when it found some particular expressions, it must change them in other expressions that I specific..Is it possibile to do? Maybe using XSLT 2.0?
  4. Ok, I'm using <xsl:output method="html" encoding="UTF-8"/> declaration and seems go well..Now I've two problems:1) How can I copy <script> tag with it's content (it's javascript code with <![CDATA[ .. ]]>)?I tryed with <xsl:copy-of select="svg:svg/svg:script" />, but it don't copy the CDATA tags! 2) How can I take only a part of a tag's attribute?I have <svg viewBox="10 10 20 20"> and I want to take only the last two numbers (20, 20) to do <canvas width="20" height="20">
  5. Thanks! By the way I must output to html(5)..how it should be?
  6. Yes I know it's a strange thing, but I must do it for a university exam ^_^What I have to do is to translate svg code in calls to the canvas drawing context API..For example convert the rect svg function to context.rect canvas HTML5 function, and so on..But I don't know how to set up the base of the XSLT file.
  7. Hi all!I'm trying to learn XSLT beacuse I need to trasform an SVG file to Canvas element of HTML5.The problem is that I know very little about XSLT, and so I hope here I can find a savior!Starting from beginning..If I have a test.svg file like this:<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet type="text/xsl" href="test_transform.xsl"?><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" > <rect x="12" y="25" /> <circle x="55" y="10" /></svg>The test_transform.xsl file, how it should be? Which references must cont
×
×
  • Create New...