[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: change element to sibling's child node
Please try the following stylesheet:
<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" encoding="UTF-8" indent="yes" /> <xsl:template match="node() | @*"> <xsl:copy> <xsl:apply-templates select="node() | @*" /> </xsl:copy> </xsl:template> <xsl:template match="stream_loop"> <stream_loop> <xsl:call-template name="loop"> <xsl:with-param name="n0" select="../number_of_streams" /> <xsl:with-param name="n" select="../number_of_streams" /> </xsl:call-template> </stream_loop> </xsl:template> <xsl:template match="CGMS_indicator" /> <xsl:template match="c_definition"> <xsl:copy> <xsl:copy-of select="service_type" /> <xsl:copy-of select="../CGMS_indicator" /> <PCR_PID_indicator>4112</PCR_PID_indicator> <xsl:apply-templates select="node()[not(self::service_type)]" /> </xsl:copy> </xsl:template> <xsl:template name="loop"> <xsl:param name="n0" /> <xsl:param name="n" /> <xsl:if test="$n > 0"> <stream> <xsl:copy-of select="stream_definition/stream_type" /> <PID><xsl:value-of select="4112 + 2*($n0 - $n)" /></PID> <ECM><xsl:value-of select="4112 + 2*($n0 - $n) + 1" /></ECM> <xsl:copy-of select="stream_definition/descriptors_loop_length" /> <xsl:copy-of select="stream_definition/descriptor_loop" /> </stream> <xsl:call-template name="loop"> <xsl:with-param name="n0" select="$n0" /> <xsl:with-param name="n" select="$n - 1" /> </xsl:call-template> </xsl:if> </xsl:template> </xsl:stylesheet> On 8/22/06, Lin, Jessica <jlin@xxxxxxxxxxx> wrote:
-- Regards, Mukul Gandhi http://gandhimukul.tripod.com
|
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
|