xsl-list
[Top] [All Lists]

Re: Returning HTML tags from a function not working

2006-02-02 10:36:22
So there is no way to generate a verbatim output of the contents of the "doc" 
tag. Does this mean
that I'll have to create templates for all <b> and all other HTML tags which 
copies the text to
the output and also applys templates?

Seems to me, there must be some way to say that I need to copy everything in an 
element as it is
to the output (including the tags).

Thanks,
Anupam.


--- David Carlisle <davidc(_at_)nag(_dot_)co(_dot_)uk> wrote:



Changing a newline to a br is an explict example in the XS:T2 spec.

see
http://www.w3.org/TR/xslt20/#regex-examples
you want to apply this to text nodes, so

<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="."/>
  </xsl:non-matching-substring>
</xsl:analyze-string>
</xsl:template>


together with an identity template to copy the rest of the document.

All I want to do is output any tags inside the "doc" as they are,
XSLT has no access to the tags in your source document (and can not
directly generate tags in the result). The tags in your source are used
by an XMl parser to produce a node tree that XSLT uses as input, but the
parser does not report what tags were used.

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

But the doc element node does have a b element child, and two text node
children, and that's all XSLT needs to know.

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
________________________________________________________________________

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--




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

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--