Here is an actual XML document and a HTML repersentation of how the data looks
now in a different application. This is one of the smallest examples I could
easily find. I will eventually need to recreate the following result using
XSLT. I was trying to work in steps and work up to this result. I figured if
I could get the headers and links working, that this would be a piece of cake.
Jason
RESULT:
<p><a onclick="collapseExpand('C1D36AD6-AF40-2191-186F75360EDFC68C')">Outcome
Variable Taxonomy </a></p>
<ul id="C1D36AD6-AF40-2191-186F75360EDFC68C">
<li><input class="chk" type="checkbox"
value="C1D4D365-EA88-5C4F-FAB81770A0AC2644"
name="C1D36AD6AF402191186F75360EDFC68C">General social-emotional</li>
<li><input class="chk" type="checkbox"
value="C1D43F44-FBA2-DE2D-F8CD8CB2B8EE6E46"
name="C1D36AD6AF402191186F75360EDFC68C">School-based outcomes</li>
<p><a onclick="collapseExpand('C1D3A3BB-E758-A04F-A8D931944237E376')">Risk
Behavior</a></p>
<ul id="C1D3A3BB-E758-A04F-A8D931944237E376">
<p><a
onclick="collapseExpand('C1D5D54A-9920-89CA-84272C46959D1D26')">Attitudes</a></p>
<ul id="C1D5D54A-9920-89CA-84272C46959D1D26">
<li><input class="chk" type="checkbox"
value="C1D6E86E-F832-7D07-B3357FB33D608D57"
name="C1D36AD6AF402191186F75360EDFC68C"> Reactions to situations involving drug
use</li>
<li><input class="chk" type="checkbox"
value="C1D7192E-B78A-39A1-A0B6748DD843941C"
name="C1D36AD6AF402191186F75360EDFC68C">Knowledge about substnce abuse</li>
<li><input class="chk" type="checkbox"
value="C1D7646C-D5D1-C83D-46DE63350A420A49"
name="C1D36AD6AF402191186F75360EDFC68C"> Normative beliefs about high risk
behaviors</li>
<li><input class="chk" type="checkbox"
value="C1D798A6-DC91-977F-5C23E71C48C3A005"
name="C1D36AD6AF402191186F75360EDFC68C">Intentions to use substance </li>
<li><input class="chk" type="checkbox"
value="C1D7CC3F-C6D9-E432-CEB93632D2FF766A"
name="C1D36AD6AF402191186F75360EDFC68C">Attitudes towards guns and violence
</li>
<li><input class="chk" type="checkbox"
value="C1D7FB1F-E0CA-60F9-68A730FF6FFDFC57"
name="C1D36AD6AF402191186F75360EDFC68C">Risk-taking </li>
<li><input class="chk" type="checkbox"
value="C1D85310-D982-22EA-30F33C61C3CF4D29"
name="C1D36AD6AF402191186F75360EDFC68C"> Attitudes towards use </li>
</ul>
<p><a onclick="collapseExpand('C1D5FC9B-EF99-3550-267A3EEFA27C4841')">Drug
Use</a></p>
<ul id="C1D5FC9B-EF99-3550-267A3EEFA27C4841">
<li><input class="chk" type="checkbox"
value="C1D91C1E-0EBD-709A-6A67395B38D560DF"
name="C1D36AD6AF402191186F75360EDFC68C">Frequencey of use </li>
<li><input class="chk" type="checkbox"
value="C1D93C30-ABA2-C201-A81FA06C31476C43"
name="C1D36AD6AF402191186F75360EDFC68C">Quantities used </li>
<li><input class="chk" type="checkbox"
value="C1D959E8-0844-1651-A47B01E93622FD6D"
name="C1D36AD6AF402191186F75360EDFC68C"> Polydrug use </li>
</ul>
<p><a
onclick="collapseExpand('C1D62FAB-9688-51D9-1D019E3C5E95370C')">Sexual behavior
</a></p>
<ul id="C1D62FAB-9688-51D9-1D019E3C5E95370C">
<li><input class="chk" type="checkbox"
value="C1DA5AAF-A954-2A76-C357CD3A92EE1E08"
name="C1D36AD6AF402191186F75360EDFC68C">Sexual activity </li>
</ul>
<li><input class="chk" type="checkbox"
value="C1D659D0-944E-AC37-C722399D7A784522"
name="C1D36AD6AF402191186F75360EDFC68C">Protective skills </li>
<li><input class="chk" type="checkbox"
value="C1D6854D-F205-B6DE-BAD8C556875FA249"
name="C1D36AD6AF402191186F75360EDFC68C">Violence/Aggresion </li>
<li><input class="chk" type="checkbox"
value="C1D6AF7A-ADAC-7B93-E5EA78D4ABC4C8D6"
name="C1D36AD6AF402191186F75360EDFC68C">General misbehavior </li>
</ul>
<li><input class="chk" type="checkbox"
value="C1D3EB58-A264-0B08-099AA7082309B383"
name="C1D36AD6AF402191186F75360EDFC68C">Pro-social competencies </li>
</ul>
XML DOC:
<?xml version="1.0" encoding="UTF-8"?>
<standards>
<standard id="C1D36AD6-AF40-2191-186F75360EDFC68C" name="Outcome
Variable Taxonomy" description="">
<standard id="C1D4D365-EA88-5C4F-FAB81770A0AC2644"
name="General social-emotional" description=""/>
<standard id="C1D43F44-FBA2-DE2D-F8CD8CB2B8EE6E46"
name="School-based outcomes" description=""/>
<standard id="C1D3A3BB-E758-A04F-A8D931944237E376" name="Risk
Behavior" description="">
<standard id="C1D5D54A-9920-89CA-84272C46959D1D26"
name="Attitudes" description="">
<standard
id="C1D6E86E-F832-7D07-B3357FB33D608D57" name="Reactions to situations
involving drug use" description=""/>
<standard
id="C1D7192E-B78A-39A1-A0B6748DD843941C" name="Knowledge about substnce abuse"
description=""/>
<standard
id="C1D7646C-D5D1-C83D-46DE63350A420A49" name="Normative beliefs about high
risk behaviors" description=""/>
<standard
id="C1D798A6-DC91-977F-5C23E71C48C3A005" name="Intentions to use substance"
description=""/>
<standard
id="C1D7CC3F-C6D9-E432-CEB93632D2FF766A" name="Attitudes towards guns and
violence" description=""/>
<standard
id="C1D7FB1F-E0CA-60F9-68A730FF6FFDFC57" name="Risk-taking" description=""/>
<standard
id="C1D85310-D982-22EA-30F33C61C3CF4D29" name="Attitudes towards use"
description=""/>
</standard>
<standard id="C1D5FC9B-EF99-3550-267A3EEFA27C4841"
name="Drug Use" description="">
<standard
id="C1D91C1E-0EBD-709A-6A67395B38D560DF" name="Frequencey of use"
description=""/>
<standard
id="C1D93C30-ABA2-C201-A81FA06C31476C43" name="Quantities used" description=""/>
<standard
id="C1D959E8-0844-1651-A47B01E93622FD6D" name="Polydrug use" description=""/>
</standard>
<standard id="C1D62FAB-9688-51D9-1D019E3C5E95370C"
name="Sexual behavior" description="">
<standard
id="C1DA5AAF-A954-2A76-C357CD3A92EE1E08" name="Sexual activity" description=""/>
</standard>
<standard id="C1D659D0-944E-AC37-C722399D7A784522"
name="Protective skills" description=""/>
<standard id="C1D6854D-F205-B6DE-BAD8C556875FA249"
name="Violence/Aggresion" description=""/>
<standard id="C1D6AF7A-ADAC-7B93-E5EA78D4ABC4C8D6"
name="General misbehavior" description=""/>
</standard>
<standard id="C1D3EB58-A264-0B08-099AA7082309B383"
name="Pro-social competencies" description=""/>
</standard>
</standards>
-----Original Message-----
From: Dimitre Novatchev [mailto:dnovatchev(_at_)yahoo(_dot_)com]
Sent: Friday, September 26, 2003 3:41 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] Re: Re: recursive help
So where did "standard" elements disappear?
Also, what is the rule for producing the numbers? I don't see in the output
any subsections, while your source.xml is nested and probably will result in
sections having subsections.
To put it shortly, this output bears no resemblance to the source.xml
Could you, please, provide a short but complete example, that shows how
exactly your source.xml will have to be transformed?
=====
Cheers,
Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL
"Wagstaff, Jason" <WagstaffJ(_at_)msx(_dot_)umsl(_dot_)edu> wrote in message
news:8ECAAC981350F94084F02B5E7699DC600AB479(_at_)STL-MAIL2(_dot_)umsl(_dot_)edu(_dot_)(_dot_)(_dot_)
I would like the results to look something like this. It is sort of like a
book,section,chapter senario.
<h>title of book</h>
<h>Section 1</h>
<a>chapter 1</a>
<h>chapter 2</h>
<a>subchapter 1</a>
<h>Section 2</h>
<a>chapter 1</a>
<a>chapter 2</a>
<h>Section 3</h>
<h>Section 4</h>
<a>chapter 1</a>
the problem is that I will never know how deep/levels the standard can be.
tia,
jason
-----Original Message-----
From: Dimitre Novatchev [mailto:dnovatchev(_at_)yahoo(_dot_)com]
Sent: Friday, September 26, 2003 2:57 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] Re: recursive help
And what should be the output?
=====
Cheers,
Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL
"Wagstaff, Jason" <WagstaffJ(_at_)msx(_dot_)umsl(_dot_)edu> wrote in message
news:8ECAAC981350F94084F02B5E7699DC600AB478(_at_)STL-MAIL2(_dot_)umsl(_dot_)edu(_dot_)(_dot_)(_dot_)
i have an xml document that needs to be transformed which seems to
perfect
for recursion. (this is my first attempt at trying this) it is essentialy
a
nested menu system of links. the basic logic is it checks to see if a node
has a child, if it does print a header otherwise a link. i built the
xml
document using recursion, i just can't figure out how to transform it
useing
the same technique. samples of both xml and xslt
xml doc:
<?xml ?>
<standards>
<standard id="1" name="test">
<standard id ="32" name="test" />
<standard id ="45" name="test>
<standard id ="23" name="test" />
<standard id ="12" name="test" />
</standard>
</standard>
</standards>
xslt:
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:template name="buildmenu">
<xsl:param name="foo" />
<xsl:choose>
<xsl:when test="position()!=last()">
<xsl:choose>
<!-- test to see if foo has children
if so print header -->
<xsl:when test="count($foo) != 0">
has child print header
<h2><xsl:value-of select="@name" /></h2>
<xsl:call-template name="buildmenu">
<xsl:with-param name="foo" select="$foo" />
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<!-- no children print link -->
<a><xsl:attribute
name="href">addlinkinfol8r</xsl:attribute><xsl:value-of
select="@name" /></a>
<xsl:call-template name="buildmenu">
<xsl:with-param name="foo" select="$foo" />
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<a><xsl:attribute
name="href">addlinkinfol8r</xsl:attribute><xsl:value-of
select="@name" /></a>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="standards">
<xsl:call-template name="buildmenu">
<xsl:with-param name="foo" select="standard" />
</xsl:call-template>
</xsl:template>
<!--<xsl:template match="standards">
<xsl:for-each select="standard">
<a><xsl:attribute
name="href">addlinkinfol8r</xsl:attribute><xsl:value-of
select="@name" /></a>
</xsl:for-each>
</xsl:template> -->
</xsl:transform>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list