In article <ea**************************@posting.google.com >,
Luke Olek <ol******@go2.pl> wrote:
% How to transform:
% <html>
% <h1>Title</h1>
% <h2>Header1</h2>
% Content
% <h3>Subeader1</h3>
% Subcontent
% </html>
You need templates to match each of the tags you want to change.
Here's one for html:
<xsl:template match="html">
<newsletter>
<xsl:apply-templates>
</newsletter>
</xsl:template>
the one for title will be similar. For the section headers,
you can do essentially the same thing. To get a value into the
attribute, use an attribute value template:
<xsl:template match="h1">
<section header="{text()}">
<xsl:apply-templates>
</section>
</xsl:template>
to copy the content,
<xsl:template match="node()|@*">
<copy>
<xsl:apply-templates select="node()|@*">
</copy>
</xsl:template>
once you get to the lowest-level heading, you can fast-path the copy
by using <xsl:copy-of select="node()"/> instead of xsl:apply-templates.
--
Patrick TJ McPhee
East York Canada
pt**@interlog.com