Dean Maslic wrote:
Not sure if this is the right place to ask (as it could easily be a PhD research
topic) but maybe someone can sugest a good approach/reading, even better some
xslt code to do this...
Im trying to identify a maximum of 10 logical sections of an arbitary web/xhtml
document and add a name-anchor at the beginning of each section.
What I mean by section is things like navigation-menus, blocks of text/image
content, groups of links and similar.
For example, http://xmlsoft.org/ has four distinct sections:
1. Heading + Images,
2. Main Menu
3. Related Links
4. main content (could also be subdivided into further 3 text and 3 link/list
sections)
I would like a stylesheet to identify those sections and add <a name="$id"/> at
the beginning of each, leaving everything else intact.
Hi,
Do you want to do this with any xhtml or do you have a site with
consistent markup? You really can't do this in a generic way. If you
have a set of pages with consistent markup you could use an identity
transformation for the bulk of it and create match templates for the
specific sections you want to identify. For example:
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="@*"/>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
<xsl:template name="continue-on">
<xsl:copy>
<xsl:apply-templates select="@*"/>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
<xsl:template match="/html/body/div[1]/div[4]">
<a name="nav"/>
<xsl:call-template name="continue-on"/>
</xsl:template>
<xsl:template match="/html/body/div[1]/div[5]">
<a name="whatever"/>
<xsl:call-template name="continue-on"/>
</xsl:template>
best,
-Rob
Any input welcome
Dean
--~------------------------------------------------------------------
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>
--~--
--~------------------------------------------------------------------
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>
--~--