Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
273 views
in Technique[技术] by (71.8m points)

xml - XSLT diffrence in stylesheets

in my last question i thought i have problem with the XML but there wasn't such a big difference.

i think the problem in the XSL in fact, is there away to know how to bind my XSL stylesheet by the XML or maybe to create XSL that can work with a lot of XML types?

how should my stylesheet suppose to look if thats my XML:

<?xml version="1.0"?>
<ArrayOfParticipantEvent xmlns="http://schemas.datacontract.org/2004/07/Accounts" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
    <ParticipantEvent>
      <PublicProfile>
        <AccountID>323877</AccountID>
        <PhotoID>6429</PhotoID>
      </PublicProfile>
   </ParticipantEvent>
</ArrayOfParticipantEvent>

i just can see all the data of my XML in text on the screen like it ignore the XSL file.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

after some debuging i found that this line in the xml made that problam with transform the xml:

xmlns="http://schemas.datacontract.org/2004/07/Accounts"

you can see this line in the xml above.

but still i dont know if the problam is in the xml or the xsl but to solve this issue just need to clear the namespace in DataContract like that:

 [DataContract(Namespace="")]

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...