Have you considered using sablotron's Excellent Named Buffer support?

I do this all the time.

ie: $addl_buffers['MySecondBuffer'] = "<?xml
version='1.0'?><MyNode>Blah</MyNode>"
    $addl_buffers['MyThirdArbitraryBuffer'] = ... etc etc etc...

then, in stylesheet, for instance:

<xsl:variable name="TestBuffer"
select="document('arg:/MySecondBuffer')/MyNode"/>

etc, etc.

On Mon, 01 Apr 2002 11:08:12 -0500, Erik Price wrote:


> On Friday, March 29, 2002, at 01:56  PM, Erik Price wrote:
> 
<snip/>

> 
> 
> Much thanks to Sean Scanlon for showing me how to create HTML attributes
> from XML with XSLT.
> 
> 
> 
> Erik
> 
> 
> 
> ----
> 
> Erik Price
> Web Developer Temp
> Media Lab, H.H. Brown
> [EMAIL PROTECTED]
> 
>> From: Erik Price <[EMAIL PROTECTED]> Date: Fri Mar 29, 2002  01:56:55
>> PM US/Eastern To: [EMAIL PROTECTED] Subject: [PHP] IMPORTANT
>> question for anyone using XSLT
>>
>> My, there have been a lot of questions about XSLT in the past 24 hrs...
>> admittedly most of them coming from me.  In addition to my first
>> question (repeated below for clarity), I have a second one -- how do I
>> perform an XSLT transformation on multiple XML documents?  Do I need to
>> perform a separate XSLT transformation on each one?  The reason I ask
>> is b/c I am pulling my XML from a DB, so there may be more than one
>> based on the results from the query.  If anyone can answer this, that'd
>> be great.
>>
>> If not, perhaps you can help with this situation, which I believe will
>> probably plague just about any PHP programmer who will ever use XSLT
>> with PHP (or possibly any other language):
>>
>> I am still unsure of the best way to mix PHP & [X]HTML together in an
>> XSLT stylesheet, because regardless of whether you specify the output
>> method as "text" or "xml", if you are using HTML tags they must be
>> well-formed, because Sablotron or expat (not sure which) will want the
>> XSLT stylesheet to be a well-formed document.  Only, we often interrupt
>> our HTML code when using PHP, like this:
>>
>> $output_to_browser = "<a href='index.php'>Go"; $output_to_browser .=
>> "home</a>";
>>
>> (of course, the output to the browser will by a hyperlink to index.php
>> that says "Go home".)
>>
>> The above looks fine as PHP code, but if you try to manipulate the data
>> from an XSLT process in this fashion, you won't be able to use HTML
>> tags -- the greater-than and less-than symbols can't be used, since an
>> XSLT sheet is technically an XML document and these are not well-formed
>> tags.  In the XSLT sheet, the above might look like:
>>
>> <xsl:template match="location">
>>  <a href="<xsl:value-of select="php_document" />">Go Home</a>
>> </xsl:template>
>>
>> I thought that perhaps if I specified text as the output method, then
>> the greater-than and less-than signs wouldn't be parsed, so I could use
>> them as such:
>>
>> <xsl:output method="text" />
>>
>> <xsl:template match="location">
>>  <xsl:text>
>>    <a href="
>>  </xsl:text>
>>     <xsl:value-of select="php_document" />
>>  <xsl:text>
>>    ">Go Home</a>
>>  </xsl:text>
>> </xsl:template match="location">
>>
>> See what's happening in the above?  I thought I had "escaped" my <a>
>> tags by placing them within the <xsl:text> tags, but this is not so --
>> they are parsed, and the document is then interpreted as not being
>> well-formed.
>>
>>
>> So unless you want to do a straight XML-to-XML or XML-to-XHTML
>> transformation, OR you don't want to use ANY XML or XHTML tags in your
>> output document, you're kind of up a river.  Unless someone on this
>> list can help me find a way to "escape" the HTML tags when creating PHP
>> code.
>>
>> And the only way I can think of doing it (which I still haven't tested,
>> but might have to use) is to use variables to represent the HTML tags
>> so that instead of
>>
>> <a href="    and     ">Go Home</a>
>>
>> I could use
>>
>> $astartag = "<a href='";
>> $aendtag = "'>Go Home</a>";
>>
>> and then make the style sheet like this:
>>
>> <xsl:output method="text" />
>>
>> <xsl:template match="location">
>>  <xsl:text>
>>    $astartag
>>  </xsl:text>
>>     <xsl:value-of select="php_document" />
>>  <xsl:text>
>>    $aendtag
>>  </xsl:text>
>> </xsl:template match="location">
>>
>>
>> That should work in theory.  But it's incredibly crude.
>>
>>
>> What do you all think?
>>
>>
>>
>>
>>
>> Erik
>>
>>
>>
>>
>>
>>
>>
>> ----
>>
>> Erik Price
>> Web Developer Temp
>> Media Lab, H.H. Brown
>> [EMAIL PROTECTED]
>>
>>
>> -- PHP General Mailing List (http://www.php.net/) To unsubscribe,
>> visit: http://www.php.net/unsub.php
>>
>>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to