Re: [xsl] Writing a stylesheet to create a stylesheet, with XSLT in the XML

Subject: Re: [xsl] Writing a stylesheet to create a stylesheet, with XSLT in the XML
From: "Scott Moore" <puffandtoot@xxxxxxx>
Date: Tue, 18 Jun 2002 08:23:03 -0400
Andrew wrote:

> I would hazard a guess that he originally hadn't tried (or tried and
> failed) using namespace-alias for a 2-pass setup, and instead tried to
> implement it by emebedding the second-phase xslt in the xml.  Why else
> would you bother?  What situation is there for that kind of setup?

Wrong.  I have been using namespace aliases just fine for a long time.
Namespace aliases are definitely the way to go for simply creating a
stylesheet from a stylesheet.

My original email never stated I didn't know how to create a stylesheet from
a stylesheet.  What I said (rather poorly I guess) was that I was having
trouble getting XSLT embedded in my XML into my stylesheet, hence the whole
discussion on d-o-e.

Now, the reasons why I need to do it are customer driven.  In other words,
the real world intrudes and sometimes you have to leave behind the argument,
"you shouldn't do it that way because it's not portable, etc.".  I tend to
take a more pragmatic view and do it the "correct" way when possible, but
when that falls apart, "anyway possible in the amount of development time
available".

As for the whole d-o-e argument, I never could get <xsl:value-of
disable-output-escaping="yes" select="..."/> to work the way I think it
should.  When I use it, I get the following in my output stylesheet:

<?javax.xml.transform.disable-output-escaping ?>&lt;xsl:value-of
select=&quot;/Doc/FirstName&quot;/&gt;<?javax.xml.transform.enable-output-es
caping ?>

Which still doesn't work.  And the processing instructions cause XML Spy to
croak.  I'm using Xalan-Java 2.0.1.  Out of curiosity, I'll probably post
this on the Xalan list to see what they say.

At any rate, I've left behind d-o-e and implemented a different solution.  I
hope this help everyone breathe easier.  ;)

Scott

P.S. In case anyone's wondering, my solution involves a recursive string
parsing template.  Anything between two | characters is taken as a XPath
expression.  Anything else is static text.  So, the following string "My
name is |/Doc/FirstName|.", would translate into the output stylesheet as:

My name is <xsl:value-of select="/Doc/FirstName"/>.


Now, if anyone wants to debate the merits of this approach...I'm listening.
(Frasier pun intended).


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


Current Thread