|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] XPOINTER to HTML by XSL
Dear all, Here is the message without attachment with text files, I have created a small "test_pointer.xml" file and used xpointer in there, pointing at "attachment.xml", as below. ************************ test_pointer.xml ************************ <?xml version="1.0" encoding="UTF-8" ?> <!-- Created by npatel on 06 March 2002, 11:49 --> <test_xpointer> <attachment href="c:\tmp\attachment.xml#xpointer(/root/products/product[1])" /> </test_xpointer> ************************ attachment.xml ************************ <?xml version="1.0" encoding="UTF-8" ?> <!-- Created by npatel on 06 March 2002, 11:54 --> <root>
<products region="SouthWest">
<product id="p1">
<prodid>V123049</prodid>
<name>Bendable Sunglasses</name>
<price>$30</price>
<quantity>1,030</quantity>
</product>
<product id="p2">
<prodid>C039890</prodid>
<name>Sports Wrist Watch</name>
<price>$60</price>
<quantity>1,430</quantity>
</product>
</products>
</root>Then I created xsl file (test_pointer.xsl) to create html output file(test_pointer.html) ************************ test_pointer.xsl ************************ <?xml version="1.0" encoding="UTF-8" ?> <!--
Document : test_xpointer_ss
Created on : 06 March 2002
Author : npatel
Comment
purpose of transformation follows.
--><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:xalan="http://xml.apache.org/xalan" exclude-result-prefixes="xalan"> <xsl:template match="test_xpointer">
<html>
<h1>Test of XPointers</h1>
<head /> <body>
<table border="2">
<xsl:for-each select="attachment">
<tr>
<td>
<xsl:variable name="doc-ref" select="document(@href)" /><xsl:value-of select="$doc-ref/@id" /> </td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template></xsl:stylesheet> Now when I applied XALAN transformation using java, I was expecting <td>p1</td> instead of <td></td> in the output file. I don't know why. I thought when xsl file applies transformation, it goes to test_pointer.xml file and when it finds attachment xpointer as href, it should grab value of product/@id, but clearly it does not. Please tell me what am I doing wrong? ************************ test_pointer.html ************************ <html xmlns:fo="http://www.w3.org/1999/XSL/Format"> <h1>Test of XPointers</h1> <head> </head> <body> <table border="2"> <tr> <td>p2</td> </tr> </table> </body> </html> Thans very much in advance. Nilesh Patel _________________________________________________________________ Chat with friends online, try MSN Messenger: http://messenger.msn.com XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








