xsl-list
[Top] [All Lists]

matching node(s) between start/end processing instruction tags

2003-02-24 12:49:33
Howdy,

I want to change spaces between nolinebreak start and end processing
instructions. My xml looks like this:
        <?Pub _nolinebreak?>word1 word2<?Pub /_nolinebreak?>

I want my output to be:
        word1&nbsp;word2

My template (which handles the unpaired _newline pi just dandy) looks like
this:
=======
<xsl:template match="processing-instruction('Pub')">
  <xsl:variable name="mypi">
    <xsl:value-of select="."/>
  </xsl:variable>
  <xsl:choose>
    <xsl:when test="$mypi='_newline '">
      <br/>     
    </xsl:when>
    <xsl:when test="$mypi='_nolinebreak '">
        what goes here?
    </xsl:when>
    <xsl:otherwise></xsl:otherwise>
  </xsl:choose>
</xsl:template>
=======

Don't ask why the test requires a space at the end of the PI. I don't know.
I don't like it much either!

I expected to be able to match the start/end components of the PIs and a
node. Instead, I'm matching either the start (_nolinebreak) or the end
(/_nolinebreak) PI tag. Best would be a way to match them as a node. Ok,
would be to see some code that handles the xpath manipulation required to
select the nodes between them (I could have a mix, I guess).

I'm using Epic/Xalan.

Thanks.
------
Paul Nagai

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



<Prev in Thread] Current Thread [Next in Thread>