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

RE: Transformation with XSLT & XML In Same File

Subject: RE: Transformation with XSLT & XML In Same File
From: Strolia-Davis Christopher Contr MSG/MAT <Christopher.Strolia-Davis@xxxxxxxxxxxx>
Date: Wed, 28 Jan 2004 10:17:18 -0500
xml xsl same file
Hi Ron,

you said:

> Anyways a have one document with the xml definition at the 
> beginning of the
> document and xslt at the end (or vice versa is possible). I 
> would like to
> transform the xml.

This method is a bit unconventional, and it may not be exactly 
what you are asking for, but it works in the Gecko based and IE 
browsers.

Don't know if it would work in any of the other parsers, or if 
it would work on a backend.

<?xml version="1.0"?>
<?xml-stylesheet type='text/xsl' href='this.xml'?>
<xsl:stylesheet 
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
	version="1.0" 
	xmlns:z="MyXMLStuff" 
	exclude-result-prefixes="z">

	<!-- XSL transformation here -->

	<xsl:output method="html"/>

	<xsl:template match="z:MyZRoot"	>
		<html>
			<body>
				<h1>
					<xsl:apply-templates select="z:hello"/>
					<xsl:text> </xsl:text>
					<xsl:apply-templates select="z:world"/>
				</h1>
			</body>
		</html>		
	</xsl:template>

	<xsl:template match="z:hello">
		<i>
			<xsl:value-of select="."/>
		</i>
	</xsl:template>
	<xsl:template match="z:world">
		<xsl:value-of select="."/>
	</xsl:template>


	<!-- Actual XML portion here with a namespace prefix -->

	<z:MyZRoot>
		<z:hello>Hello</z:hello>
		<z:world>World!</z:world>
	</z:MyZRoot>

</xsl:stylesheet>

This approach is probably not very efficient.

Chris Strolia-Davis
Database Specialist
Contractor - CDO Technologies Inc.

> -----Original Message-----
> From: Ronald Kent Gibson [mailto:Kent.Gibson@xxxxxxxxxxx]
> Sent: Wednesday, January 28, 2004 8:55 AM
> To: 'XSL-List@xxxxxxxxxxxxxxxxxxxxxx'
> Subject:  Transformation with XSLT & XML In Same File
> 
> 
> Dear All
> 
> Before any one asks, why would you ever want to do such a 
> thing, I am sort
> of forced into.
> 
> Anyways a have one document with the xml definition at the 
> beginning of the
> document and xslt at the end (or vice versa is possible). I 
> would like to
> transform the xml.
> 
> Do any of the transformers support such a funny set up, or am 
> I going to
> have to split up the files some way.
> 
> thanks
> 
> kent
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 

 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.