下面用一个邮件合并程序来简要说明XPath的串函数。下面的XML文件中包含数据,XSLT文件中包含对邮件格式的定义。MSXML4.0对XML文档应用样式表,产生一个合并的邮件文本文档。
XML文件 Letter.xml
<?xml version="1.0" encoding="UTF-8"?>
<Letter>
<Date>July 17, 2002</Date>
<To>
<FirstName>Vicky</FirstName>
<LastName>P</LastName>
<Sex>Male</Sex>
</To>
<Address>
<Line1>900 National Pkwy</Line1>
<Line2>Suite 105</Line2>
<City>Bellevue</City>
<State>WA</State>
<Zip>98007</Zip>
<Country>USA</Country>
</Address>
<Subject>ESTATE OF JOHN DOE / FILE NO. 12345.6789</Subject>
<Text>
Please pay the property taxes as soon as possible.
</Text>
<Sender>
<FirstName>John</FirstName>
<LastName>M</LastName>
<Title>Sr. Tax Consultant</Title>
</Sender>
</Letter>