Subject: RE: [xsl] Selecting unparsed text from inside a tag From: "Angela Williams" <Angela.Williams@xxxxxxxxxxxxxxxxxx> Date: Tue, 25 Mar 2008 14:08:05 -0500 |
There was a thread going where someone else wanted the entire content of <p>Some text and <br/> some more <b>text</b>.</p> in their output. They were using <xsl:value-of select="p"> and wondered why they didn't see all the lovely nested nodes, also. Michael suggested copy-of or apply-templates. I said I sometimes use xsl:sequence (instead of value-of, copy-of, apply-templates) and wondered if there might be side effects to using xsl:sequence for this purpose that I may not know about.... Thanks! Angela "We cannot solve problems by using the same kind of thinking we used when we created them." -Albert Einstein -----Original Message----- From: David Carlisle [mailto:davidc@xxxxxxxxx] Sent: Tuesday, March 25, 2008 11:48 AM To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: Re: [xsl] Selecting unparsed text from inside a tag > I've used xsl:sequence instead of xsl:value-of for this type of mixed > content. Are there any issues with this approach that will haunt me > later? your message doesn't say what the approach is (other than using sequence instead of value-of) the subject line gives some clues, but appears confused. "Selecting unparsed text from inside a tag" XSLT has no access to the tags in a source file, assuming you mean element here the content is always parsed. The only way of getting text that hasn't been parsed by an XML parser into XSLT is with the unparsed-text() function, but that never generates mixed content, it just returns a string, using xsl:value-of or xsl:sequence on the result of unparsed-text() makes no difference in most contexts. If you use xsl:value-of, it generates a text node directly, if you use xsl:sequence it generates a string, but if that string is being copied to the result tree, it is implictly wrapped in a text node. David (confused:-) ________________________________________________________________________ The Numerical Algorithms Group Ltd is a company registered in England and Wales with company number 1249803. The registered office is: Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom. This e-mail has been scanned for all viruses by Star. The service is powered by MessageLabs. ________________________________________________________________________
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Selecting unparsed text f, David Carlisle | Thread | Re: [xsl] Selecting unparsed text f, David Carlisle |
[xsl] Sibling axis: All of kind A u, Michael Ludwig | Date | Re: [xsl] XSLT 2.0 in a web browser, bryan rasmussen |
Month |