xsl-list
[Top] [All Lists]

[xsl] Copy a node inside a template but exclude a deeply nested child

2006-09-04 04:46:29

Hi Chaps,

I have an existing xslt and in one of the templates it makes a copy of a
node from the xml document, I now have the need to exclude a deeply
nested child from that copy, but I cant figure out how, I may need to
break up my template into further templates but im not sure how
exactly...

My simplified XML document looks like this -

<root>
    <categories_flat/>
    <pages/>
    <page>
        
        <!-- cut: lots of nodes -->
        
        <content>
            <main>
                <show>
                    <h1>General Enquiries</h1>
                    <p>This form is for general enquiries only.</p>
                    <br/>
                    <div id="xform">
                        <xforms:model>
                            <!-- cut: xform model -->
                        </xforms:model>
                    </div>
                </show>
            </main>
        </content>
    
    </page>
</root>


My current my XSLT document is below.
Now at the moment it deep copies the nodes inside the show node, but I
would like to exclude the xforms:model node, I cant really reference
this node by path as its nesting may be different each time, although it
will always be somewhere inside a child of the show node, although its
depth may vary. So, how can I acheieve this?


<xsl:template match="/page">
    <html>
        <head>
            <title>some page title</title>
        </head>
        <body>
            
            <!-- cut: lots of node parsing and xhtml generation -->
            
            <xsl:if test="content/main/show">
                <div class="textpage"><!-- text page -->
                    <xsl:copy-of select="content/main/show/node()"/>
                </div>
            </xsl:if>
            
        </body>
    </html>
</xsl:template>


Thanks Adam



Adam Retter

Devon Portal Principal Developer
Devon Portal Project, e-Partnership
Ext: 3683
DDI: 01392 383683
e: adam(_dot_)retter(_at_)devon(_dot_)gov(_dot_)uk

http://www.devonline.gov.uk


--~------------------------------------------------------------------
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>
--~--

<Prev in Thread] Current Thread [Next in Thread>