Subject: mixed content styling problem From: Bill dehOra <wdehora@xxxxxxxxxxxxxxxxxxx> Date: Thu, 25 May 2000 13:10:08 +0100 |
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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: Pass variables from template to, Jeni Tennison | Thread | Re: mixed content styling problem, Richard Light |
Re: Conflicting Node Values, David Carlisle | Date | RE: Which is correct, xt or SAXON?, Kay Michael |
Month |