XML Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreXML Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old July 20th, 2004, 12:30 PM
David C David C is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 3 David C User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question XSLT XML-to-SVG Problem...Is This Task Do-able?

Hi All!

I have beeen researching my problem for quite some time and haven't read any situation where someone else is doing what I need to do...it makes me wonder if anybody has attempted this task.I am working at the request of a client who has (paper-version) troubleshooting flowcharts, whereby logic trees are built on a structure given numerous Tests (rectangle), Malfunctions (diamond) and two answer-values Yes/No (circles) for each Test. The client would like for these flowcharts to be transformed from the XML files into SVG files that on being produced (I am supposing from a Perl/Java batch script), the YES/NO circles become clickable URI's which take the user to the next SVG file based on their selected decision.

I was successful at creating an XSLT which successfully performed the transformation for a 9-page (paper-version) flowchart; however, the client would like to have a one-XSLT-fits-all XML files...transforming each into a long flowing generated SVG which will navigate from every YES/NO to the appropriate new Test.

With the research that I have thus accomplished, I believe this to be an unrealistic task, primarily because each and every flowchart is unique...there are no two alike in any way in their tree structure. If they were all identical, then a template XSLT could be created, I think.

This brings me to my query. I have theorized to my colleagues that if were to break all of these flowcharts into individual elements and make them identical in form, where each work package has 1 Test, 1 Malfunction and 2 Decisions YES or NO, then it might then become possible to accomplish this task.

By breaking my XML source files into smaller packets and experimenting with flowing data into an SVG transformation, I was successful to that end; however, the largest issue that I just can't seem to crack is my XREF for the YES/NO value-answers. I am attempting to surround my YES and NO "<xsl:value-of select="@name"/>" with an <a> and in which the HREF value attribute is streamed from within the XREF element in order to create the appropriate URI for each YES/NO within the SVG's that are created.

Can anybody help? Is this task do-able or am I way off base?

My source files are as follows (for that particular snippet):

<!-- SOURCE: XSLT -->

<xsl:template match="select-value">
<xsl:for-each select="value-answer">
<xsl:if test="position() != last() and (@name='YES' or 'NO')">
<svg xml:space="preserve" width="100%" height="100%">
<text x="218" y="384" style="text-anchor: start; font-size: 8pt;">
<a
xmlns:xlink="http://www.w3.org/1999/xlink"
xlink:href="<!-- PROBLEM: NEED VALUE-OF "YES" XREF/HREF FROM SOURCE XML STREAMED HERE -->">
<xsl:value-of select="@name"/>
</a>
</text>
</svg>
</xsl:if>

<xsl:if test="position()=last() and (@name='YES' or 'NO')">
<svg xml:space="preserve" width="100%" height="100%">
<text x="79" y="464" style="text-anchor: start; font-size: 8pt;">
<a
xmlns:xlink="http://www.w3.org/1999/xlink"
xlink:href="<!-- PROBLEM: NEED VALUE-OF "NO" XREF/HREF FROM SOURCE XML STREAMED HERE -->">
<xsl:value-of select="@name"/>
</a>
</text>
</svg>
</xsl:if>
<xsl:apply-templates/>
</xsl:for-each>
</xsl:template>

<!-- SOURCE: XML -->

<select-value id="T00002-TS-11-5820-890-30-105" idtoken="idtokenT00002-TS-11-5820-890-30-105" name=" ">
<indication name="content">
<pcnarr>5 DIGIT PART OF DISPLAY LIT</pcnarr>
</indication>
<value-answer name="YES">
<testblockref>
<xref href="T00003.svg"/>
</testblockref>
</value-answer>
<value-answer name="NO">
<testblockref>
<xref href="T00002.svg"/>
</testblockref>
</value-answer>
</select-value>

Reply With Quote
  #2  
Old July 20th, 2004, 02:23 PM
Teflon's Avatar
Teflon Teflon is offline
Teflon The Black
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Location: Woodbridge VA
Posts: 246 Teflon User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 28 m 14 sec
Reputation Power: 5
Send a message via AIM to Teflon
That should fix those <!--Problems-->
It should be possible.
Basically in your xml you would say where to go from each test and simply apply that to every test?

Well if you have any specific questions feel free to ask.
There are some smart people hangin around these parts.


PHP Code:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:template match="select-value">
        <svg xml:space="preserve" width="100%" height="100%">
            <xsl:for-each select="value-answer">
                <xsl:if test="position() != last() and (@name='YES' or 'NO')">
                    <text x="218" y="384" style="text-anchor:middle;font-size:8pt;">
                        <a
                            xmlns:xlink="http://www.w3.org/1999/xlink"
                            xlink:href="{testblockref/xref/@href} ">
                            <xsl:value-of select="@name"/>
                        </a>
                    </text>
                </xsl:if>
                <xsl:if test="position()=last() and (@name='YES' or 'NO')">
                    <text x="79" y="464" style="text-anchor:middle;font-size:8pt;">
                        <a
                            xmlns:xlink="http://www.w3.org/1999/xlink"
                            xlink:href="{testblockref/xref/@href} ">
                            <xsl:value-of select="@name"/>
                        </a>
                    </text>
                </xsl:if>
            </xsl:for-each>
        </svg>
    </xsl:template>
</xsl:stylesheet>


-Teflon

-edit: Code now displays both yes and no as links that work once compiled as svg via php/sablotron
__________________
Teflon - The Black <desc>Mark This Up</desc>

Reply With Quote
  #3  
Old July 20th, 2004, 03:08 PM
David C David C is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 3 David C User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thumbs up XSLT XML-to-SVG Problem...Is This Task Do-able?

Thanks, Teflon!

That was the ticket. That helpful tip got me one step closer to glory.

Best Regards,

David

Reply With Quote
  #4  
Old July 22nd, 2004, 08:16 AM
Teflon's Avatar
Teflon Teflon is offline
Teflon The Black
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Location: Woodbridge VA
Posts: 246 Teflon User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 28 m 14 sec
Reputation Power: 5
Send a message via AIM to Teflon
Ya i recently had a glory moment with svg

Its a great little tool

-Teflon

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreXML Programming > XSLT XML-to-SVG Problem...Is This Task Do-able?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT