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

Re: Multiple output types and embedded documentation

Subject: Re: Multiple output types and embedded documentation
From: Warren Hedley <w.hedley@xxxxxxxxxxxxxx>
Date: Mon, 03 Jul 2000 11:05:36 -0400
types of embedded questions
Obviously I needed more exclamation marks in my subject !!!! It took
so long for anyone to respond, I thought it must have been deleted
somewhere and I'd have to repost.

"Pawson, David" wrote:
> 
> Presumably, using this format, you would swap out the namespace
> of either out_1 or out_2 and replace it with the xsl namespace, to
> select the actual output wanted?

Precisely.

> 1. How do you 'disable' output from the undesired namespaces
>     when not in use.
> 2. I don't understand the 'intermediate step' idea above.

David Carlisle has already posted one answer to these questions, but
I think it should be possible to have a more general solution, where
the user can use whatever namespaces they like, and command line
parameters are given to the "intermediate step" stylesheet, to extract
the correct outputs.

This intermediate stylesheet might contain code like this (not tested):

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

<!--
  Default values are unlikely namespaces.
  We'd need "output_ns" to possibly be a list of namespaces,
  (I use [ns_1][ns_2] kind of strings, and split the string
  up in the XSL), so that you could output HTML and DEBUG.
-->
<xsl:param name="logic_ns"    select="'***'" />
<xsl:param name="output_ns"   select="'***'" />

<xsl:variable name="xsl_ns"
    select="'http://www.w3.org/1999/XSL/Transform'" />

<xsl:template match="*[namespace-uri(.) = $logic_ns]">
  <!-- probably not the right way to do the following -->
  <xsl:element name="local-name(.)" namespace="{$xsl_ns}">
    <xsl:copy-of select="@*" />
    <xsl:apply-templates />
  </xsl:element>
</xsl:template>

<xsl:template match="*[namespace-uri(.) = $output_ns]">
  <!-- strip namespace -->
  <xsl:element name="local-name(.)">
    <xsl:copy-of select="@*" />
    <xsl:apply-templates />
  </xsl:element>
</xsl:template>

</xsl:stylesheet>

A command line might look like this (where I've come up with a new
suffix) :

xslt-processor \
  template_stylesheet.txsl \        # in
  intermediate_stylesheet.xsl \     # transform
  logic_ns='org.hedley.xsl_logic' \ # the logical choice!
  output_ns='[org.hedley.html][org.hedley.xsl_trace]' \ # html + debug
  > html_debug_processor.xsl        # output

-- 
Warren Hedley


 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.