Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - traversing associations >Thread Next - Re: traversing associations Re: traversing associationsTo: NULL Date: 5/5/2005 2:02:00 PM
David Schwartz wrote:
> Here's the call from the 'report-subgoals-list' stylesheet:
>
> <xsl:call-template name="subgoals-list">
> <xsl:with-param name="class-name">XYZ</xsl:with-param>
> </xsl:call-template>
>
> and of the essence of the 'subgoals-list' stylesheet:
>
> <xsl:for-each select="//class[@name= $class-name]">
> <xsl:for-each select="association">
> <div class="generaltext"><xsl:value-of select="@target"/></div>
> <xsl:if test="//class">
> <xsl:call-template name="subgoals-list">
> <xsl:with-param name="class-name"><xsl:value-of
> select="@target"/></xsl:with-param>
> </xsl:call-template>
> </xsl:if>
> </xsl:for-each>
> </xsl:for-each>
>
> These stylesheets do produce output but it's difficult to interpret their
> success since all targets are rendered similarly. Ideally, I'd like to
> indent a list of targets relative to their parent. Any thoughts as to how
> this could be done assuming a indeterminate number of indentations would be
> really appreciated.
I am guessing a bit but as you seem to transform to HTML you can of
course use CSS to suggest the presentation of the HTML output so you
could use something alike
<xsl:for-each select="//class[@name= $class-name]">
<xsl:for-each select="association">
<div class="generaltext">
<xsl:value-of select="@target"/>
<xsl:if test="//class">
<xsl:call-template name="subgoals-list">
<xsl:with-param name="class-name"><xsl:value-of
select="@target"/></xsl:with-param>
</xsl:call-template>
</xsl:if>
</div>
</xsl:for-each>
</xsl:for-each>
and then include a stylesheet e.g.
<link href="styles.css" type="text/css" rel="stylesheet" />
in the <head> section with a rule
div.generaltext {
margin-left: 0.2em;
}
There might even be more appropriate elements in HTML, perhaps a
definition list is more what you want than the general but not very
semantic <div> element:
<xsl:for-each select="//class[@name= $class-name]">
<xsl:for-each select="association">
<dl>
<dt><xsl:value-of select="@target"/></dt>
<dd>
<xsl:if test="//class">
<xsl:call-template name="subgoals-list">
<xsl:with-param name="class-name"><xsl:value-of
select="@target"/></xsl:with-param>
</xsl:call-template>
</xsl:if>
</dd>
</dl>
</xsl:for-each>
</xsl:for-each>
--
Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
