Jeb,
At 11:58 AM 1/13/2005, you wrote:
Then I thought fiddling with the 'select' expr in the value-of tag would
do it, but I can't figure out if there's a magical combination of XPath
slang that means, "whatever the hell is below here, be it tags or text, i
want them".
xsl:value-of copies the string value of whatever it selects to the result.
The string value of a node is the concatenation of string values of its
text node descendants, which is what accounts for what you're seeing.
As JBryant just said, to copy an entire subtree (not just the context node)
from source to result, xsl:copy-of is the thing.
But the bit of XPath slang you ultimately will want is xsl:apply-templates.
This says "process what I'm selecting by finding templates to match, and
applying them". This way, you could not only copy that bit mixing text
nodes with <a> elements, but you could also transform the <a> elements. In
this case you might not have to do that (they are already what you want) --
but soon you will.
This is the heart of the XSLT processing model, and hence of XSLT.
So, using something like your example:
source:
<xmlroot>
<child>some text</child>
<child><link href="">a link</link> to something</child>
</xmlroot>
result:
<ul>
<li>some text</li>
<li><a href="">a link</a> to something</li>
</ul>
try:
<xsl:template match="xmlroot">
<ul>
<xsl:apply-templates/>
</ul>
</xsl:template>
<xsl:template match="child">
<li>
<xsl:apply-templates/>
</li>
</xsl:template>
<xsl:template match="link">
<a href="{(_at_)href}">
<xsl:apply-templates/>
</a>
</xsl:template>
Once you understand what this does and why (the first part is a question
you can ask your processor), you'll be set on the straight and narrow path
to XSLT mastery.
Cheers,
Wendell
======================================================================
Wendell Piez
mailto:wapiez(_at_)mulberrytech(_dot_)com
Mulberry Technologies, Inc. http://www.mulberrytech.com
17 West Jefferson Street Direct Phone: 301/315-9635
Suite 207 Phone: 301/315-9631
Rockville, MD 20850 Fax: 301/315-8285
----------------------------------------------------------------------
Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================
--~------------------------------------------------------------------
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>
--~--