Skip to content
Hub Nexus

No author yetClaim it

Version 1Updated 1 min read

Support

Motivation

You want to dynamically load and render SVG.

Sample Program

<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ev="http://www.w3.org/2001/xml-events"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xf="http://www.w3.org/2002/xforms"
xmlns:svg="http://www.w3.org/2000/svg">
<head>
<title>SVG Browser</title>
<style type="text/css">
#svgimg .xforms-value {
width: 400px;
min-width: 400px;
height: 400px;
min-height: 400px;
}
</style>
<xf:model>
<xf:instance id="current">
<current xmlns=""/>
</xf:instance>
<xf:instance id="names">
<names xmlns="">
<name fname="mozilla.svg">Mozilla</name>
<name fname="wii.svg">Wii</name>
<name fname="duke.svg">Duke</name>
<name fname="git.svg">Git</name>
<name fname="cartman.svg">Cartman</name>
<name fname="tiger.svg">Tiger</name>
<name fname="gcheck.svg">GCheck</name>
<name fname="pencil.svg">Pencil</name>
<name fname="python.svg">Python</name>
<name fname="ietf.svg">IETF</name>
<name fname="osgr_pie.svg">OSGR Pie</name>
</names>
</xf:instance>
<xf:instance id="inlinesvg">
<svg xmlns='http://www.w3.org/2000/svg'/>
</xf:instance>
<xf:submission id="loadsvg"
method="get"
replace="instance"
instance="inlinesvg"
serialization="none"
mode="synchronous">
<xf:resource value="concat('svg/',.)"/>
</xf:submission>

<xf:action ev:event="xforms-ready">
<xf:setvalue ref="." value="instance('names')/name[1]/@fname"/>
<xf:send submission="loadsvg"/>
</xf:action>
</xf:model>
</head>
<body>
<h1>SVG Browser</h1>
<xf:select1 ref="." appearance="minimal" incremental="true">
<xf:label>Select SVG: </xf:label>
<xf:itemset nodeset="instance('names')/name">
<xf:label ref="."/>
<xf:value ref="@fname"/>
</xf:itemset>
<xf:send ev:event="xforms-value-changed" submission="loadsvg"/>
</xf:select1>

<xf:trigger>
<xf:label>Next</xf:label>
<xf:setvalue ev:event="DOMActivate"
ref="."
value="if(
instance('names')/name[
preceding-sibling::name[1]/@fname
= current()
],
instance('names')/name[
preceding-sibling::name[1]/@fname
= current()
]/@fname,
instance('names')/name[1]/@fname)"/>
</xf:trigger>

<br/>
<xf:output id="svgimg"
value="xf:serialize(instance('inlinesvg'))"
mediatype="image/svg+xml"/>
</body>
</html>

Credits

This was created by Alain Couthures on the XSLTForms mailing list. A working copy can currently be found on the AgenceXML web site.

Where this page came from

This page was imported from Wikibooks. From “XForms” on Wikibooks, by its contributors, under CC BY-SA 4.0. Changed here: set as a page; navigation and edit links left out; each image under its own licence, credited in its caption.

Nobody has written it yet — it is the source material at a new address, which is why search engines are asked to skip it and why no one earns from it. It is up for grabs: take it on, and it is yours to rewrite and to earn from.

Get each new page of

XForms

Following means one email when a page is added, nothing when a page changes.

Following means one email when a page is added, nothing when a page changes.

Comments

Spinner Logo

Next in XForms

CC BY-SA 4.0
But unlike most JavaScript functions, it will not be loaded into the browser until it is needed. ## Sample Program Here is an example of using the load element within an XForms trigger: First you will need a small JavaScript function to test like the following: <script type="text/javascript"> var My
CC BY-SA 4.0
XForms, Pie Chart
CC BY-SA 4.0
For a simple Pie Chart these might include: cht=p &chd=t:10,20,30,40,20 &chl=Amount|Indicator|Code|Date|Text &chs=400x300 Where: ** - is the Chart API's base URL The ampersand (&) separates parameters. **cht=p** is a code for the chart's type. For example p=2D Pie Chart and p3-3D Pie Chart **chd=t:1
CC BY-SA 4.0
Sending a **submit** will alter the Venn Diagram REST parameters. ### Screen Image of User Interface ![XForms User Interface for Venn Diagram]( XForms User Interface for Venn Diagram (Image: The original uploader was Dmccreary at English Wikibooks ., CC BY-SA 3.0) ### Output of Call to Google Charts
CC BY-SA 4.0
I also need to use CSS to clean up the markup. Price and Demand P Q Demand Input: Price = 100 Output: Quantity = 100 Adjust price by moving the slider. Note that as the input (price) changes. the quantity sold also changes.
CC BY-SA 4.0
This is an example of a self-referential data structure. This is common when manipulating graphs. Workflow systems frequently use these structures. ## Link to Working Example [Graph Editor]( ## XML Schema Here is a sample XML Schema with a recursive data type (a data type that includes an instance o