|
Subject: [xsl] Get extern xml document represented by a string From: "Paulo Henrique S. Bermejo" <bermejo@xxxxxxxxxxx> Date: Mon, 10 Dec 2001 14:16:07 -0300 |
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 |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| RE: [xsl] Dumb questions from a new, Chris Bayes | Thread | Re: [xsl] Get extern xml document r, Jeni Tennison |
| RE: [xsl] Output conditional on pre, Delany Nick | Date | Re: [xsl] for loop, Mitch C. Amiano |
| Month |