output syntax problem

Discussion in 'XML' started by Bill Sneddon, Jun 25, 2003.

  1. Bill Sneddon

    Bill Sneddon Guest

    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.
     
    Bill Sneddon, Jun 25, 2003
    #1
    1. Advertising

  2. Bill Sneddon

    Derek Harmon Guest

    "Bill Sneddon" <> wrote in message news:bdcpse$399$...
    > <%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:eek:utput 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
     
    Derek Harmon, Jun 25, 2003
    #2
    1. Advertising

  3. Bill Sneddon

    Bill Sneddon Guest

    Re: output syntax problem... thanks

    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:eek:utput method='text'/> locally
    within a file.

    It seem that the <xsl:eek:utput 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" <> wrote in message news:bdcpse$399$...
    >
    >><%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:eek:utput 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
    >
    >
     
    Bill Sneddon, Jun 26, 2003
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Paul
    Replies:
    1
    Views:
    446
  2. Tom Petersen

    Syntax problem with HTML output in email

    Tom Petersen, Oct 23, 2003, in forum: ASP General
    Replies:
    4
    Views:
    199
    Tom Petersen
    Oct 24, 2003
  3. gabriele renzi
    Replies:
    2
    Views:
    242
    gabriele renzi
    Dec 31, 2005
  4. Ken Bloom
    Replies:
    3
    Views:
    246
  5. Good Night Moon
    Replies:
    9
    Views:
    320
    Rick DeNatale
    Jul 25, 2007
Loading...

Share This Page