|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: grouping nodes inside a new parent node
David,
Thanks for the information it helped a lot. Just in case anyone else was interested and to close this thread this is what is working for me. Perhaps it could be a little more elegant but....... I have also included the source of channel-list.xml which is used earlier in the xslt NB. This: <xsl:copy-of select=".|following-sibling::table|following-sibling::subheading|following-sibling::para|following-sibling::images|following-sibling::top|following-sibling::list"/> was the only way I could think of saying every following sibling except <notes>. Explicitly saying all the following-siblings I want except <notes>. I notice XSLT 2.0 has provision for this, anything better than what I have used?
<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/> <xsl:variable name="contentnodes"/> <xsl:template match="@xsi:noNamespaceSchemaLocation"> <xsl:attribute name="xsi:noNamespaceSchemaLocation">http://www.bath.ac.uk/bucs/system/xxeconfig/config/news/newseditor.xsd</xsl:attribute> </xsl:template> <xsl:template match="publish-to"> <xsl:copy> <xsl:for-each select="document('channel-list.xml')/channels/area"> <xsl:variable name="attname"> <xsl:value-of select="."/> </xsl:variable> <xsl:choose> <xsl:when test="$attname = //publish-to/*"> <xsl:attribute name="{$attname}"><xsl:text>true</xsl:text></xsl:attribute> </xsl:when> <xsl:otherwise> <xsl:attribute name="{$attname}"><xsl:text>false</xsl:text></xsl:attribute> </xsl:otherwise> </xsl:choose> </xsl:for-each> </xsl:copy> </xsl:template> <xsl:template match="para[position() > 1]|table|subheading|images|top|list"/> <xsl:template match="notes"> <xsl:copy> <xsl:apply-templates select="child::*"/> </xsl:copy> </xsl:template> <xsl:template match="news-item/para[1]"> <content> <xsl:copy-of select=".|following-sibling::table|following-sibling::subheading|following-sibling::para|following-sibling::images|following-sibling::top|following-sibling::list"/> </content> </xsl:template> <xsl:template match="@*|node()"> <xsl:copy> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:template> </xsl:stylesheet>
<?xml version="1.0" encoding="UTF-8"?> <channels> <area>business</area> <area>international</area> <area>research</area> <area>swindon</area> <area>sport</area> <area>research</area> <area>releases</area> <area>community</area> <area>campus</area> </channels> --On 25 February 2005 12:27 +0000 David Carlisle <davidc@xxxxxxxxx> wrote:
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








