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

Re: 2 XML Files, 1 XSLt Output to HTML

Subject: Re: 2 XML Files, 1 XSLt Output to HTML
From: Abel Braaksma <abel.online@xxxxxxxxx>
Date: Wed, 18 Oct 2006 19:21:18 +0200
Re:  2 XML Files
McDonald, Shaun wrote:
XSLT Version 1.0:
<xsl:template match="n1:share">
    <xsl:variable name="x" select="@item" />
    <xsl:variable name="xx" select="@loc" />
    <xsl:for-each select="document(@loc)">
      <xsl:value-of select="current()"/>
    </xsl:for-each>
 </xsl:template>

I want,
TARGET: doc2.xml:
<Oproc>
<Para>
<bold id="ao1">text1</bold>
<extRef id="getmaster" href="somedoc.html#idTitle1234"
reflocation="*" refmanual=""/>
</Para>


You are using <xsl:value-of> here. Surely that's not what you want. You don't want the *value* (which returns a string representation of the nodes in the select expression) but a *copy* of all the nodes. Change "value-of" to "copy-of" and you are done (it will copy comment nodes and processing instructions as well but not the opening xml declaration).

Another little thing, why the for-each? You can remove it and just use:
<xsl:copy-of select="document(@loc)" />

(it is only from xslt 2.0 that document(xx) function can be used on a sequence and will return multiple documents, in which case the for-each could make sense)

Cheers,

-- Abel Braaksma
  http://www.nuntia.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

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.