Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: traversing associations

From: Martin Honnen <mahotrash@-----.-->
To: 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/


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent