急求教XML问题
我的xml文档数据如下
<?xml version= "1.0 " encoding= "gb2312 " ?>
- <Root Description= "用户套房 " MemberID= "1159 " HouseID= "88 " HouseName= "LuoWei的房间 " HouseType= "10 " HouseImg= "/Images/Shop/User/defaultManBody.gif " Visited= "744 " LastUpdate= "4/11/2007 4:32:38 PM ">
- <Room>
- <Data RoomID= "房间1 " RoomName= "房间1 ">
+ <Furniture RoomID= " ">
<Data ID= "0 " Type= "wall " zIndex= "-999 " Left= "0 " Top= "0 " Src= "/Images/Shop/House/defaultwall.gif " />
<Data ID= "0 " Type= "floor " zIndex= "-997 " Left= "0 " Top= "214 " Src= "/Images/Shop/House/defaultfloor.gif " />
<Data ID= "1558 " Type= "goods " zIndex= "0 " Left= "269 " Top= "154 " Src= "/Images/Shop/House/2830.gif " />
<Data ID= "1559 " Type= "goods " zIndex= "6 " Left= "412 " Top= "327 " Src= "/Images/Shop/House/2642.gif " />
<Data ID= "1560 " Type= "goods " zIndex= "7 " Left= "383 " Top= "58 " Src= "/Images/Shop/House/1210.gif " />
<Data ID= "1561 " Type= "goods " zIndex= "0 " Left= "82 " Top= "355 " Src= "/Images/Shop/House/2452.gif " />
<Data ID= "1562 " Type= "goods " zIndex= "8 " Left= "467 " Top= "200 " Src= "/Images/Shop/House/2782.gif " />
<Data ID= "1564 " Type= "goods " zIndex= "9 " Left= "281 " Top= "-25 " Src= "/Images/Shop/House/1413.gif " />
<Data ID= "1565 " Type= "goods " zIndex= "10 " Left= "100 " Top= "167 " Src= "/Images/Shop/House/295.gif " />
<Data ID= "1566 " Type= "goods " zIndex= "11 " Left= "-2 " Top= "210 " Src= "/Images/Shop/House/289.gif " />
<Data ID= "1567 " Type= "goods " zIndex= "12 " Left= "-6 " Top= "344 " Src= "/Images/Shop/House/979.gif " />
<Data ID= "2661 " Type= "floor " zIndex= "-996 " Left= "0 " Top= "214 " Src= "/Images/Shop/House/2664.gif " />
<Data ID= "2685 " Type= "goods " zIndex= "13 " Left= "127 " Top= "281 " Src= "/Images/Shop/House/2556.gif " />
<Data ID= "3150 " Type= "goods " zIndex= "14 " Left= "99 " Top= "-41 " Src= "/Images/Shop/House/1772.gif " />
<Data ID= "3158 " Type= "wall " zIndex= "-998 " Left= "0 " Top= "0 " Src= "/Images/Shop/House/1422(1).gif " />
</Furniture>
+ <People>
<Data ID= "75 " Body= "/Images/Shop/User/defaultManBody.gif " Head= " " UpperPart= "/Images/Shop/User/suit_2115_m.gif " LowerPart= " " Shoes= "/Images/Shop/User/shoes_2424_m_f.gif " HeadDecorate= " " TieInDecorate= " " Strap= " " Scarf= " " Other= " " zIndex= "15 " Left= "280 " Top= "120 " />
</People>
<Dialog />
</Data>
- <Data RoomID= "房间2 " RoomName= "房间2 ">
- <Furniture>
<Data ID= "0 " Type= "wall " zIndex= "-999 " Left= "0 " Top= "0 " Src= "/Images/Shop/House/defaultwall.gif " />
<Data ID= "0 " Type= "floor " zIndex= "-997 " Left= "0 " Top= "214 " Src= "/Images/Shop/House/defaultfloor.gif " />
</Furniture>
- <People>
<Data ID= "1478 " Body= "/Images/Shop/User/defaultManBody.gif " Head= " " UpperPart= "/Images/Shop/User/suit_2115_m.gif " LowerPart= " " Shoes= "/Images/Shop/User/shoes_2424_m_f.gif " HeadDecorate= " " TieInDecorate= " " Strap= " " Scarf= " " Other= " " zIndex= "1 " Left= "0 " Top= "0 " />
</People>
<Dialog />
</Data>
</Room>
+ <Goods>
- <Data>
<ID> 8037 </ID>
<GoodsName> 春意盎然 </GoodsName>
<GoodsImgPreview> /Images/Shop/House/1606s.gif </GoodsImgPreview>
<GoodsImg> /Images/Shop/House/1606(1).gif </GoodsImg>
</Data>
- <Data>
<ID> 8033 </ID>
<GoodsName> 紫藤花 </GoodsName>
<GoodsImgPreview> /Images/Shop/House/2786s.gif </GoodsImgPreview>
<GoodsImg> /Images/Shop/House/2786.gif </GoodsImg>
</Data>
- <Data>
<ID> 7667 </ID>
<GoodsName> 中世纪落地窗 </GoodsName>
<GoodsImgPreview> /Images/Shop/House/1649s.gif </GoodsImgPreview>
<GoodsImg> /Images/Shop/House/1649.gif </GoodsImg>
</Data>
- <Data>
<ID> 7665 </ID>
<GoodsName> 苏格兰风景落地窗 </GoodsName>
<GoodsImgPreview> /Images/Shop/House/949s.gif </GoodsImgPreview>
<GoodsImg> /Images/Shop/House/949.gif </GoodsImg>
</Data>
- <Data>
<ID> 7664 </ID>
<GoodsName> 苏格兰风景落地窗 </GoodsName>
<GoodsImgPreview> /Images/Shop/House/949s.gif </GoodsImgPreview>
<GoodsImg> /Images/Shop/House/949.gif </GoodsImg>
</Data>
- <Data>
<ID> 1348 </ID>
<GoodsName> 花纹雕刻银柜 </GoodsName>
<GoodsImgPreview> /Images/Shop/House/2642s(1).gif </GoodsImgPreview>
<GoodsImg> /Images/Shop/House/2642.gif </GoodsImg>
</Data>
- <Data>
<ID> 1332 </ID>
<GoodsName> 负离子空调 </GoodsName>
<GoodsImgPreview> /Images/Shop/House/2319s.gif </GoodsImgPreview>
<GoodsImg> /Images/Shop/House/2319.gif </GoodsImg>
</Data>
</Goods>
</Root>
我在xsl样式表里想把 <Data RoomID= "房间2 " RoomName= "房间2 "> 的子元素都列出来应该怎么写,我是这样写的
<xsl:for-each select= "Furniture/Data[@RoomID==房间2] ">
<span id= "Furn{@Type}{@ID} " style= "z-index:{@zIndex}; position:absolute;left:{@Left}px; top:{@Top}px " class= "DragGoods " _id= "{@ID} " type= "{@Type} " _left= "{@Left} " _top= "{@Top} " _Src= "{@Src} ">
<img src= "{@Src} " id= "DIV_{@Type}{@ID}_Img "/>
<span style= " position:absolute;filter:alpha(opacity=0); -moz-opacity:0; width:1px; height:1px; "> 0 </span>
</span>
</xsl:for-each>
可是为什么会出错呢,提示读取XML数据失败! 请各位高手救命!小第感激不尽!
[解决办法]
什么情况下读取失败?
[解决办法]
<xsl:for-each select= "Furniture/Data[@RoomID==房间2] ">
改成
<xsl:for-each select= "Room/Data[@RoomID==房间2] ">
试下.
注意路径.