Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

xsl problem

Status
Not open for further replies.

mowu

Programmer
Joined
Sep 10, 2004
Messages
1
Location
DE
hello i changed the sofftodocbookheadings.xsl to fit my needs.
I want to use for ex. the openoffice "bold" button to format my text. It it not supportet by docbook translation. So i added the following:
Code:
<xsl:template match="text:p[@text:style-name='P1']">
	<xsl:element name="bold">
		<xsl:apply-templates/>
	</xsl:element>
</xsl:template>
This works and produces:
Code:
<bold>fettdfasd</bold>
Problem: When only a portion of the text is bold then the whole paragraph is treted as bold.
in OO-xml it looks like:
Code:
<text:p text:style-name="Standard"/><text:p text:style-name="P1">bold written text<text:span text:style-name="T1">this should be not bold</text:span>bold again</text:p>

so how can i solve the problem?
I need a closing </bold> when the
Code:
<text:span text:style-name="T1">
begins. And also again an opening <bold> after the
Code:
</text:span>
and of course the closing </bold> after the
Code:
</text:p>
Has anybody a good idea?
Thanks in advance!
 
Code:
   <xsl:template match="text()">
      <xsl:choose>
         <xsl:when test="../../*[@text:style-name='P1']">
            <bold>
               <xsl:value-of select="." />
            </bold>
         </xsl:when>

         <xsl:otherwise>
            <xsl:value-of select="." />
         </xsl:otherwise>
      </xsl:choose>
   </xsl:template>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top