473,414 Members | 1,609 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

output syntax problem

Can any one tell me how to output the following string?

<%response.write "<tr><td><a href=""file://SERVER/mmlogs/TNAME" &
yearmonth & """>"& "MYJUNK" & "</a><BR></td></tr>" %>

<xsl:variable name="SERVER" select="MM_NAME" />
<xsl:variable name="TNAME" select="TOOL_NAME" />

I would want SERVER,TNAME and MYJUNK filled in at transform time.

I am using Python PYANA ver .8 (which is XLAN) to create the transform.
I have spent a lot of time messing around with this to no good end.

Jul 20 '05 #1
2 2877
"Bill Sneddon" <bs******@yahoo.com> wrote in message news:bd**********@ngspool-d02.news.aol.com...
<%response.write "<tr><td><a href=""file://SERVER/mmlogs/TNAME" &
yearmonth & """>"& "MYJUNK" & "</a><BR></td></tr>" %>
In your XSLT stylesheet (Python-irrelevant) you'd have the following in an
xsl:template (whitespace/indentation added for readability), and you would
pass yearmonth (and any other Python variables) to the stylesheet as
parameters,

<![CDATA[<%response.write "]]>
<tr>
<td>
<a href="file://{$SERVER}/mmlogs/{$TNAME}{$YEARMONTH}" >
<xsl:value-of select="$MYJUNK" />
</a>
<br/>
</td>
</tr>
%>

Both parameters and variables can be referenced within your stylesheet's
templates with $PARAM_OR_VARIABLE_NAME. They can be injected
into quoted text (ie, attribute values) by enclosing the parameter or variable
reference in curly braces, as shown above.
I have spent a lot of time messing around with this to no good end.


A few pointers if you'll be modifying the stylesheet to accept global
parameters is that it requires <xsl:param name="YEARMONTH" />
(etc.) tags as the immediate children of the opening <xsl:stylesheet ...>
tag. Then your Python environment should offer a means for passing
arguments to the stylesheet before kicking off the Transform process.

Look for overloaded methods that take a list of arguments in the
documentation, and pass the Python variables you're using like
yearmonth to the stylesheet beforehand.

If yearmonth is a JSP or other after-the-fact variable identifier that you
don't have at transformation time, then what else you might try is to
set the xsl:output mode to text and do something literal with CDATA
sections in the stylesheet, like (newlines added for readability):

<!-- . . . -->
<xsl:text>&lt;a href='file://</xsl:text>
<xsl:value-of select="$SERVER"/>
<xsl:text>/mmlogs/</xsl:text>
<xsl:value-of select="$TNAME"/>
<xsl:text>" & yearmonth & "'"></xsl:text>
<!-- . . . -->

Notice I took advantage of HTML's allowance for either single-quote
or double-quotes, having runs of """ can be problematic.
HTH,

Derek Harmon
Jul 20 '05 #2
Thanks Derek,

I was able to make this work by changing the output to text and
and escaping all of my <> in my html tags.
It is NOT pretty but it works.

I did some reading but was unable to figure out how to make the output
be & < > inside a html output file.

What I would like is the behavior of <xsl:output method='text'/> locally
within a file.

It seem that the <xsl:output method='xml|html|text'/> is a top level
element. So I works for the whole transform. I would like to switch
between output methods in a transform where it make the XSL more
readable for me. Is there a way to do this?

If not, I wonder if it is being concidered for XSL 2.x or beyond
Bill
Derek Harmon wrote:
"Bill Sneddon" <bs******@yahoo.com> wrote in message news:bd**********@ngspool-d02.news.aol.com...
<%response.write "<tr><td><a href=""file://SERVER/mmlogs/TNAME" &
yearmonth & """>"& "MYJUNK" & "</a><BR></td></tr>" %>

In your XSLT stylesheet (Python-irrelevant) you'd have the following in an
xsl:template (whitespace/indentation added for readability), and you would
pass yearmonth (and any other Python variables) to the stylesheet as
parameters,

<![CDATA[<%response.write "]]>
<tr>
<td>
<a href="file://{$SERVER}/mmlogs/{$TNAME}{$YEARMONTH}" >
<xsl:value-of select="$MYJUNK" />
</a>
<br/>
</td>
</tr>
%>

Both parameters and variables can be referenced within your stylesheet's
templates with $PARAM_OR_VARIABLE_NAME. They can be injected
into quoted text (ie, attribute values) by enclosing the parameter or variable
reference in curly braces, as shown above.

I have spent a lot of time messing around with this to no good end.

A few pointers if you'll be modifying the stylesheet to accept global
parameters is that it requires <xsl:param name="YEARMONTH" />
(etc.) tags as the immediate children of the opening <xsl:stylesheet ...>
tag. Then your Python environment should offer a means for passing
arguments to the stylesheet before kicking off the Transform process.

Look for overloaded methods that take a list of arguments in the
documentation, and pass the Python variables you're using like
yearmonth to the stylesheet beforehand.


If yearmonth is a JSP or other after-the-fact variable identifier that you
don't have at transformation time, then what else you might try is to
set the xsl:output mode to text and do something literal with CDATA
sections in the stylesheet, like (newlines added for readability):

<!-- . . . -->
<xsl:text>&lt;a href='file://</xsl:text>
<xsl:value-of select="$SERVER"/>
<xsl:text>/mmlogs/</xsl:text>
<xsl:value-of select="$TNAME"/>
<xsl:text>" & yearmonth & "'"></xsl:text>
<!-- . . . -->

Notice I took advantage of HTML's allowance for either single-quote
or double-quotes, having runs of """ can be problematic.
HTH,

Derek Harmon


Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Isaac Councill | last post by:
Hello, This seems like a newbie question, but I couldn't find the answer on google. I've been using xsl to transform rdf files into runnable programs in another (non-markup) language. It's...
0
by: Dimitre Novatchev | last post by:
You seem to be unaware of the xslt processing which uses the built-in rules in the absence of templates that match some selected node. http://www.w3.org/TR/xslt#built-in-rule According to the...
13
by: Peter Ammon | last post by:
I invented a new (AFAIK) way of doing the O part of C's I/O that is safer than printf() without sacrificing much convenience. It looks a bit like C++'s formatted output, without the stupid gotchas...
4
by: Bill Cohagan | last post by:
I'm writing a console app (in C#) and I want to be able to redirect the standard input/output streams when it's run at a command prompt. IOW I want to support the "<" and ">" redirection syntax....
7
by: mmarlow | last post by:
Hi all, I wish I knew if this was even a PHP problem or not! It's probably Internet Explorer but here goes anyway... Random pages at random times don't appear correctly in IE6, the HTML is...
10
by: Flavio | last post by:
Hi, I try to write here because maybe my problem is a common one. I have a rather complicated multithreaded program, which uses the POSIX pthread standard. A master routine calls a series of...
8
by: Alec MacLean | last post by:
Hi, I'm using the DAAB Ent Lib (Jan 2006) for .NET 2.0, with VS 2005 Pro. My project is a Web app project (using the WAP add in). Background: I'm creating a survey system for our company, for...
2
by: peridian | last post by:
I've gotten a really weird result crop up on my site, and I can't find any information on the web that it has been seen elsewhere. Given how weird this is, I guess it's probably a symptom of either...
8
by: Rami | last post by:
Hi, I'm looking for ANTLR input file with C++ grammar which is configured for C# output. Does anybody know where can I find it?
87
by: pereges | last post by:
I have a C program which I created on Windows machine. I have compiled and executed the program on windows machine and it gives me the consistent output every time i run it. for eg. input a = 2,...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.