Subject: [xsl] template question: copy-of and non-continuous children and grandchildren From: Mike Ferrando <mikeferrando@xxxxxxxxx> Date: Fri, 1 Mar 2002 08:52:39 -0800 (PST) |
Dear List (et al.), I have a question about how I can call a template for children and grandchildren in as <xsl:copy-of select="node()"/>. I have been processing all C1007 nodes with a template. But these C1007 nodes occur at different levels of the C1009 node sometimes as great great grand children but all C1007 are within ITEM node. What do you think would be the best way to do this? Mike F. XML: My xml is rather huge. I hope my schema will suffice. Here is my C1007 template: <xsl:template match="C1007"> <xsl:element name="NOTE"> <xsl:attribute name="ENCODINGANALOG"> <xsl:value-of select="./@LINK"/> </xsl:attribute> <xsl:element name="P"> <xsl:copy-of select="node()"/> </xsl:element> </xsl:element> </xsl:template> Here is my C1009 template: <xsl:template match="C1009"> <xsl:element name="NOTE"> <xsl:attribute name="ENCODINGANALOG"> <xsl:value-of select="./@LINK"/> </xsl:attribute> <xsl:element name="LIST"> <xsl:copy-of select="node()[not(child::C1007)]"/> </xsl:element> </xsl:element> </xsl:template> Here is my schema: <element name="C1009" occurs="62"> <element name="HEAD" occurs="62"/> <element name="ITEM" occurs="355"> <element name="TITLE" occurs="246"> <element name="EMPH" occurs="1"/> </element> <element name="LIST" occurs="109"> <element name="HEAD" occurs="109"/> <element name="ITEM" occurs="262"> <element name="TITLE" occurs="262"> <element name="EMPH" occurs="1"/> </element> <element name="C1007" occurs="26"> <element name="PERSNAME" occurs="1"/> <element name="TITLE" occurs="29"/> <element name="DATE" occurs="1"/> </element> <element name="C1010" occurs="1"> <element name="PERSNAME" occurs="2"/> </element> <element name="C1011" occurs="2"/> </element> </element> <element name="C1007" occurs="13"> <element name="TITLE" occurs="10"/> <element name="DATE" occurs="2"/> <element name="CORPNAME" occurs="1"/> <element name="SUBJECT" occurs="2"/> </element> <element name="C1011" occurs="2"/> </element> </element> __________________________________________________ Do You Yahoo!? Yahoo! Greetings - Send FREE e-cards for every occasion! http://greetings.yahoo.com XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Calling xslt templates from a, Andrew Mottershead | Thread | Re: [xsl] template question: copy-o, Jeni Tennison |
[xsl] Stylesheet parameters, Curtis Burisch | Date | [xsl] generic xslt, Bryan Rasmussen |
Month |