xsl-list
[Top] [All Lists]

[xsl] Re: Identity Transformation of XML for web display

2006-03-18 17:59:03
Woops, missing the mode="wbtTransformForHTMLDisplay" in above apply-templates.

On 3/18/06, Karl Stubsjoen <kstubs(_at_)gmail(_dot_)com> wrote:
Here is what I have so far:

<xsl:template match="node()" mode="wbtTransformForHTMLDisplay">
<div>
 <xsl:text>&gt;</xsl:text>
 <xsl:value-of select="name(.)"/>
   <xsl:apply-templates select="@*"/>
 <xsl:text>&lt;</xsl:text>
   <xsl:value-of select="."/>
 <xsl:text>&gt;/</xsl:text>
 <xsl:value-of select="name(.)"/>
 <xsl:text>&lt;</xsl:text>
</div>
</xsl:template>

<xsl:template match="@*" mode="wbtTransformForHTMLDisplay">
 <xsl:value-of select="concat(name(.), '=',."/>
</xsl:template>


On 3/18/06, Karl Stubsjoen <kstubs(_at_)gmail(_dot_)com> wrote:
Hello,

I'd like to create an identity tranformation that replaces "<" this
and ">" this to "&lgt;" and "&glt" for display of the XML document on
an HTML page.  I can handle this part, but would like help with the
spacing of the elements as they appear hierachely.  So example, how to
space:

into

<A>
  <B>
      <C/>
  </B>
</A>

you have to be very intuitive as to knowing at which depth you are in
your transformation to style this something like:


<div style="indent_3">&glt;C&glt;</div>

where style indent_3 is a margin of 20px for example.

Any help would be appreciated.

Karl..



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>