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

Re: XSLT template from XSLT + XML

Subject: Re: XSLT template from XSLT + XML
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Mon, 30 Sep 2002 21:20:10 +0100
xslt template match
Hi Michael,

> I am trying to take an XML file and an XSL file, transform them
> using MSXML 3.0, and output an XSL. I have two files that I've
> gotten this to work for by liberally using the xsl:element and
> xsl:attributes.
>
> The first two worked fine, I did them pretty much by hand, there
> weren't too many templates to create via xsl:element
> name="xsl:template".

I guess that you haven't discovered the delights of
xsl:namespace-alias, then. You can define an "alias" namespace which
takes the place of the XSLT namespace within your stylesheet and then
gets replaced on output. That makes it a lot easier to write the
stylesheets (though it's still a little confusing) because you can use
literal result elements rather than xsl:element/xsl:attribute.

For example, in this stylesheet 'xsl' is the prefix for XSLT
instructions to be interpreted in the stylesheet, whereas elements
without a prefix are elements to be added to the result:

<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="/">
  <stylesheet version="1.0">
    <output method="html" />
    <xsl:apply-templates />
  </stylesheet>
</xsl:template>

<xsl:template match="foo">
  <template match="{@bar}">
    ...
  </template>
</xsl:template>

</xsl:stylesheet>

> Reading this over, its difficult to accurately convey what I'm
> trying to do, much less the why. I guess what I'm wondering is, can
> I create an xsl template (a) to read in one xsl template (b) and
> output a template (c), which when combined with an xml file (x)
> containing some options, output a template (d) very similar in
> structure to template b. Then I can tweak template c to make use of
> the options in file x. Whew.

Perhaps you could give an example?

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.