[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: XSL -XML to XSL reorienting node

Subject: Re: XSL -XML to XSL reorienting node
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Thu, 27 Jun 2002 18:19:09 +0100
Re:  XSL -XML to XSL reorienting node
Hi Mike,

> What I am wondering is why I cannot seem to exclude the children
> nodes and still get the parent nodes when I reorient my
> apply-templates.

I found your description a little hard to follow, but perhaps it would
help to apply templates to everything, but have templates that match
the elements that you do not want to create templates for and do
nothing with them:

<xsl:template match="SCRGRP | SCRGRPX | NON-SCORE | SCORE" />

You might also find using xsl:namespace-alias useful. You could do
something like:

<xsl:stylesheet version="1.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns="http://www.w3.org/1999/XSL/TransformAlias">

<xsl:namespace-alias stylesheet-prefix="#default"
                     result-prefix="xsl" />

<xsl:template match="*[*]">
  <template match="{name()}">
    <apply-templates select="{name(*)}" />
  </template>
  <xsl:apply-templates />
</xsl:template>

<xsl:template match="SCRGRP | SCRGRPX | NON-SCORE | SCORE"
              priority="1" />

</xsl:stylesheet>

This will create a template for every element that contains another
element, and the template will apply templates to those children that
have the same name as the first child of that element.

The thing is that this will create a separate template for each
element, even if it has the same name as an element for which a
template has already been generated. Perhaps it would make more sense
to use your schema to create the stylesheet? And are you sure that you
only want the template to apply templates to those child elements that
are named the same as the first child element, rather than all
children?

If you'd supply an example source document and an example stylesheet
that you want generated from that source document, we might be able to
help more.

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.