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

RE: Search text and write the code

Subject: RE: Search text and write the code
From: cknell@xxxxxxxxxx
Date: Wed, 05 Sep 2007 11:47:36 -0400
RE:  Search text and write the code
The output you are asking for is not legal XML (see below), so I am not clear on what to advise.

XML requires that all elements be properly nested. The output you have specified:

<item>
  <b>
    <label>1.1</label> 
      <para>Grundbegriffe
  </b>
  <xref pointer="p0002">2</xref>
      </para>
</item>

has the <b> element overlapping the <para> element.


In XML, you can't have "<b><para></b></para>", and that's what you've specified as your desired output.

-- 
Charles Knell
cknell@xxxxxxxxxx - email



-----Original Message-----
From:     Byomokesh Sahoo <sahoo.byomokesh@xxxxxxxxx>
Sent:     Wed, 5 Sep 2007 14:46:17 +0530
To:       xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject:   Search text and write the code

Hi All,

I have some problem in my project. I need text or number search in
text and write the code. Is it possible through XSLT?

My XML
===== 
<o1item><emphasis style="b">1.1 Grundbegriffe</emphasis> <hotlink
xref="p0002" xidtype="page">2</hotlink></o1item>

XSL File
======= 
<xsl:template match="o1item">
<xsl:text>
</xsl:text><item>
<xsl:call-template name="labelstring">
                   <xsl:with-param name="Text" select="."/>
    </xsl:call-template>

			<para><xsl:apply-templates /></para>
</item>
	</xsl:template>

<xsl:template name="labelstring">
             <xsl:param name="Text"/>
            <xsl:choose>
                    <xsl:when test="contains($Text, ' ')">
                           <label>
                          <xsl:value-of select="substring-before($Text, ' ')" />

                            </label>

                    </xsl:when>
            </xsl:choose>
        </xsl:template>

On the base my style sheet output is

<item><label>1.1</label><para><b>1.1 Grundbegriffe</b><xref
pointer="p0002">2</xref></para></item>

But I need output is..........

<item><b><label>1.1</label> <para>Grundbegriffe</b><xref
pointer="p0002">2</xref></para></item>

Please anyone suggest me what can i do.

Thanks
Byomokesh Sahoo



Om Trayambakam Yajaamahe Sugandhim Pushtivardhanam
Urvaarukamiva Bandhanan Mrytor Muksheeya Mamritaat

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.