Subject: Re: [xsl] Keeping comments with relevant node when shorting nodes From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx> Date: Fri, 14 Jan 2005 18:13:16 -0500 |
<!-- comment 1 --> <!-- comment 2 --> <!-- comment 3 --> <node/> <!-- comment 4 --> <!-- comment 5 --> <node/>
<xsl:template match="node"> <xsl:copy> <xsl:copy-of select="key('comments-by-owner',generate-id())"/ </xsl:copy> </xsl:template>
<node> <!-- comment 1 --> <!-- comment 2 --> <!-- comment 3 --> </node> <node> <!-- comment 4 --> <!-- comment 5 --> </node>
Cheers, Wendell
That sorts nicely but unfortunately, we have several comments in front of some node.
I haven't been able to come up with a method of grouping the comments with their associated nodes. Would you have any suggestions?
The current xsl is:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output indent="yes" method="xml"/>
<xsl:template match="node() | @*"> <xsl:copy> <xsl:apply-templates select="@* | node()"/> </xsl:copy> </xsl:template>
<xsl:template match="Ns"> <xsl:copy> <xsl:apply-templates select="N"> <xsl:sort select="@name"/> </xsl:apply-templates> </xsl:copy> </xsl:template>
<xsl:template match="N">
<xsl:copy-of select="preceding-sibling::node()[normalize-space()][1][self::comment()]
"/>
<xsl:copy-of select="."/>
</xsl:template>
</xsl:stylesheet>
====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Keeping comments with rel, David Carlisle | Thread | Re: [xsl] Keeping comments with rel, Mike Blake-Knox |
Re: [xsl] Keeping comments with rel, David Carlisle | Date | RE: [xsl] Keeping comments with rel, Michael Kay |
Month |