[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

mixed content styling problem

Subject: mixed content styling problem
From: Bill dehOra <wdehora@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 25 May 2000 13:10:08 +0100
content styling
Hi,

I hope someone can assist me with my current situation. I am having
difficulty styling the emphasis tags within #PCDATA of mixed content. I
basically need to be able to apply further templates to a tree fragment
which is not in itself a node. I have no issues with applying templates to
inline information within elements, just where I need to seperate the
#PCDATA information from the element information within a mixed content
model.

I am not in a position to make changes to the content model.

Anyways.

Here is the XML component

<A>
<B TYPE="PUB">The following information should be seen in <E1>italics</E1>
and this is some extra information which occurs after the emphasis tags.
<C><D>Here is some additional information</D></C></B>
<B TYPE="NONPUB">This information is not for publication at this stage</B>
<B TYPE="NONPUBTOO">Neither is this information.</B>
</A>

Here is my attempt to output the following:

The following information can be seen in italics and this is some extra
information which occurs after the emphasis tags. 

<!-- Add italics to appropriate areas of the document  -->

  <xsl:template match="E1">
      <xsl:call-template name="inline.italic"/>
  </xsl:template>

  <xsl:template name="inline.italic">
    <xsl:param name="content">
      <xsl:apply-templates/>
    </xsl:param>
    <I><xsl:copy-of select="$content"/></I>
  </xsl:template>


<!-- Extract and output publish B information -->

 <xsl:template match="A">
    <xsl:call-template name="B.output"/>
  </xsl:template>
 
  <xsl:template name="B.output">
    <xsl:for-each select="B">
      <xsl:if test="string(@TYPE)='PUB'">
        <xsl:variable name="BInfo">
          <xsl:copy-of select="child::node()[following::C]"/>
        </xsl:variable>
        <H2><xsl:copy-of select="$BInfo"/></H2>
        <!-- <H2><xsl:apply-templates select="$BInfo"/></H2> -->
      </xsl:if>
    </xsl:for-each>
  </xsl:template>

Result if initial output line is used:

<H2>The following information can be seen in italics and this is some extra
information which occurs after the emphasis tags.</H2> 

Result if commented output line is used (from Saxon):

Error while applying stylehsheet
At xsl:apply-templates on line 172 of file etc...
Cannot convert value [** RESULT TREE FRAGMENT **] to a node-set

Any help would be appreciated.

cheers,

-Bill


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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.