This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


At 2002-06-17 15:16 -0400, Scott Moore wrote:
I've written a stylesheet that processes an XML file and creates another
I want to select the text from the XML and have it written out as
proper XSLT.  The problem is <xsl:text> will not let me embed an
<xsl:value-of> inside it, so I can't turn on disable-output-escaping.
Using disable-output-escaping= is not the best way one writes a stylesheet that writes a stylesheet.

Look at the <xsl:namespace-alias> instruction and how the processor sees a result tree prefix in your stylesheet as an alias to the instruction prefix in your stylesheet mapped to the XSLT namespace URI. The end result is serialized using the instruction URI with the alias namespace prefix, thus giving you a stylesheet result you can run in an XSLT processor.


Below is an example of what I want to do:

XML snippet:

<Sections label="&lt;xsl:value-of select=&quot;/Doc/FirstName&quot;&gt;"/>
Actually, nothing will let you put an instruction inside of an attribute value.

But your example is unclear on what is needed where ... were you anticipating having the end result include an instruction element inside of the attribute? This is not well-formed XML and, therefore, can't be used for a stylesheet. Do you need to write out:

<Sections>
<xsl:attribute name="label">
<xsl:value-of select="/Doc/FirstName"/>
...


I would like to take the contents of the attribute label and place it
directly in the output tree and turn off escaping of the <, > and "
characters.

Is this possible?
Not what you ask for in your example, that is impossible, but what you need from what you describe is very possible.

Check out <xsl:namespace-alias> and restate your needs in more detail if you need to ask again. Co-incidentally, what you are asking for happens to be on page 146 in that chapter of my XSLT/XPath book that Amazon have posted on their site (chapter 5). You can read this chapter in its entirety by following the "look inside this book" link found on the http://www.CraneSoftwrights.com/links/dxx-info.htm page directly beneath the photograph of the cover. Prentice-Hall have also made this chapter available at http://www.CraneSoftwrights.com/links/dxx-sample.htm in PDF.

I hope this helps.

.................. Ken


--
Upcoming: 3-days XSLT/XPath and/or 2-days XSL-FO:Sep 30-Oct 4,2002

G. Ken Holman mailto:gkholman@CraneSoftwrights.com
Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/
Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (Fax:-0995)
ISBN 0-13-065196-6 Definitive XSLT and XPath
ISBN 1-894049-08-X Practical Transformation Using XSLT and XPath
ISBN 1-894049-07-1 Practical Formatting Using XSLFO
XSL/XML/DSSSL/SGML/OmniMark services, books (electronic, printed),
articles, training (instructor-live,Internet-live,web/CD,licensed)
Next public training: 2002-08-05,26,27,09-30,10-03


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



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]