[xsl] Re: producing php with xslt

Subject: [xsl] Re: producing php with xslt
From: "flourish" <msmith@xxxxxxxx>
Date: Wed, 25 Jul 2001 17:05:33 -0400
Thanks all for the help.  I got that much working.  But now I'm having
another problem, and I've got a rough feeling that I'm not going to be able
to solve it gracefully.

I want to put a processing instruction in an attribute.  Is there any way to
do this?

Here's the code for the problem at hand, if you'll be so kind as to look at
it.  The model's a little strange, but the idea is that one stylesheet will
turn certain xml tags into php and xml code, and another stylesheet will
turn that xml into html.  Here's some stripped out code from the various
peices.  This is supposed to make a link to an article using a database id.

********* INITIAL XML **************

********* PHP PRODUCING XSLT ****
<xsl:template match="php-article-link">
  <xsl:processing-instruction name="php">
    php_code_to_get_article_data(<xsl:value-of select="text()"/>);
    <xsl:processing-instruction name="php">
    <xsl:processing-instruction name="php">

<?php php_code_to_get_article_data(4); ?>
  <location><?php php_code_to_echo_article_url; ?></location>
  <name><?php php_code_to_echo_article_name; ?></name>

******** XSLT TO PROCESS THE ABOVE XML *************
<xsl:template match="link">
        <xsl:apply-templates select="location"/>
  <xsl:apply-templates select="name"/>

<xsl:template match="processing-instruction()" priority="-1">
  <xsl:processing-instruction name="name()">
    <xsl:value-of select="."/>
  <!-- The question mark is to deal with the html formating and pi
problem -->

********** XML FROM ABOVE *******************
<?php php_code_to_get_article_data(4); ?>
<a href="php_code_to_echo_article_url; ?"><?php php_code_to_echo_name ?></a>

The stand alone php code and the name come out correctly, but the location
gets its gt and lt signs stripped.  Is there some way to change this?

Thanks, Matt

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

Current Thread