DataFile:XML 檔案路徑。TransformFile:XSLT 轉換檔。XPath:篩選暴露的節點子集,如 //User。Repeater/GridView 等僅顯示**第一層**節點。範例:temp.xml 頂層為 <User>,Repeater 可用 Eval 繫結屬性。
| 運算式 | 回傳 | 說明 |
|---|---|---|
XPath("expression", "format") | 單一值 | 對實作 IXPathNavigable 的資料項計算 XPath |
XPathSelect("expression", "format") | 節點清單 | 回傳節點集合,可再繫結給巢狀 Repeater |
//User。DataSource='<%# XPathSelect("Reply") %>' 繫結當前 User 下的 Reply 子節點。XPath("@Attr") 顯示屬性。結合平面控件與 XPath 繫結,無需撰寫遞迴程式碼即可呈現豐富階層資料。