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

RE: Writing a stylesheet to create a stylesheet, with

Subject: RE: Writing a stylesheet to create a stylesheet, with XSLT in the XML
From: "Andrew Welch" <awelch@xxxxxxxxxxxxxxx>
Date: Tue, 18 Jun 2002 14:04:06 +0100
writing a stylesheet for rss
Scott wrote:

>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.

...right, please keep reading (no need to be so abrupt, either)

>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"/>.

...So you do have control over the source xml?  Well in that case......

Firstly, why use | when you can use xml??

"My name is |/Doc/FirstName|." should become:

"My name is <path>/Doc/FirstName</path>."

And then you could use namespace-alias and the-power-of-xml to get the
result you want:

For this xml:

<root>
  <node>My name is <path>/Doc/FirstName</path>.</node>
</root>

And this stylesheet:

<xsl:stylesheet
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
	xmlns:xslt="some_made_up_namespace"
	version="1.0">
	
<xsl:namespace-alias
  	stylesheet-prefix="xslt"
  	result-prefix="xsl"/>
	
<xsl:template match="//node">
  <xsl:variable name="path" select="path"/>
  <xslt:stylesheet>
    <xslt:value-of select="{$path}"/>
  </xslt:stylesheet>
</xsl:template>

</xsl:stylesheet>


You get this result:

<?xml version="1.0" encoding="UTF-16"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:value-of select="/Doc/FirstName" />
</xsl:stylesheet>


Im sure this is what you need, but I dont want to second guess your reqs
- let us know if this is what you want.

cheers
andrew


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.350 / Virus Database: 196 - Release Date: 17/04/2002
 

 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.