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

Re: Returning HTML tags from a function not working

Subject: Re: Returning HTML tags from a function not working
From: Agnisys <agnisys@xxxxxxxxx>
Date: Thu, 2 Feb 2006 06:42:14 -0800 (PST)
clock html tag
Hi David,
  I guess I have caused more confusion by showing my code!
  All I want to do is output any tags inside the "doc" as they are, and replace newlines with <br
/>

So input is :
<doc>
  This is a <b>Test</b>
  Message.
</doc>
----------------
Output should be :
  This is a <b>Test</b><br />
  Message.
----------------

I understand now that in my code when I pass the "doc" node to my function, it doesn't even see
the <b> tags.

Any pointers would be appreciated.
Thanks,
Anupam.
 


--- David Carlisle <davidc@xxxxxxxxx> wrote:

> 
> what are you passing as the input to this function?
> 
> your parameter is called docnode, but you can not be passing teh
> document node as it is typed as element()* and document nodes are
> necessarily not elements.
> 
> If $docnode is empty, you return nothing, and if it is non empty
> you pass it to xsl:analyze-string whic as it's name implies expects a
> string as its select expression not a sequence of elements.
> 
> So if you have nore than one element in $docnode you will get an error
> and if there is just one element in $docnode you will analyze teh string
> value of that element (ie just take all the character data, ignoring any
> elements).
> 
> Note that XSLT has _no_ access to the tags in an input document, they
> are all resolved by an XML parser before XSLT starts.
> 
> I suspect you want to start with an identity transform then add a
> template
> 
> <xsl:template match="text()">
>     <xsl:analyze-string  select="." regex="\n">
>        <xsl:matching-substring><br /></xsl:matching-substring>
>        <xsl:non-matching-substring>
>          <xsl:value-of select="normalize-space(.)"/>
>        </xsl:non-matching-substring>
>      </xsl:analyze-string> 
> </xsl:template>
> 
> David
> 
> ________________________________________________________________________
> This e-mail has been scanned for all viruses by Star. The
> service is powered by MessageLabs. For more information on a proactive
> anti-virus service working around the clock, around the globe, visit:
> http://www.star.net.uk
> ________________________________________________________________________
> 
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

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

Buy Stylus Studio Now

Cast Your Vote

We need your help – Vote for DataDirect XML Products!

  • Best SOA or XML site

Winners and finalists announced at SOA World Conference in November.

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-2007 All Rights Reserved.