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

Get extern xml document represented by a string

Subject: Get extern xml document represented by a string
From: "Paulo Henrique S. Bermejo" <bermejo@xxxxxxxxxxx>
Date: Mon, 10 Dec 2001 14:16:07 -0300
xslt document string
HI ALL,


How can I get another xml document, represented by a string, to use in my
xslt?

I now that, if this document is in a file I could get using the function
"document", but this xml document is in a string.

What could I do?

I maked a simple example using the function document, but in my case I can't
use this function because I have the document "customer.xml" in a string.

(I am using the Xalan).


XML Document (main)
----------------------------------------------------------------------------
---------------------
<orders>
   <order>
       <id>1</id>
       <customerid>2</customerid>
       <totalprice>143.89</totalprice>
   </order>
</orders>


XML Document (extern) - "customer.xml"
----------------------------------------------------------------------------
---------------------
<customers>
   <customer>
       <id>1</id>
       <name>Scott</name>
   </customer>
   <customer>
       <id>2</id>
       <name>Paul</name>
   </customer>
</customers>


XSLt Document
----------------------------------------------------------------------------
---------------------
<xsl:stylesheet ......>
<xsl:output method="html" encoding="ISO-8859-1"/>

<xsl:template match="orders">
    <xsl:text>ORDERS</xsl:text>
    <br/>
    <xsl:apply-templates match="order"/>
</xsl:template>

<xsl:template match="order">
     <xsl:text>Order nº </xsl:text>
     <xsl:value-of select="id"/>
     <br/>

     <xsl:text>Customer Name: </xsl:text>
     <xsl:variable name="var_custid" select="customerid"/>
     <xsl:value-of
select="document('customer.xml')/customers/customer[id=$var_custid]/name"/>
     <br/>

     <xsl:text>Price: </xsl:text>
     <xsl:value-of select="price"/>
</xsl:template>

.....</xsl:stylesheet>
----------------------------------------------------------------------------
----------------------


Thanks in advance!!!


Paulo Henrique Bermejo


Ps.: This is very important to end the my project.



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.