I have two xml responses as below.
response1.xml
<UploadFileResponse xmlns="http://SharepointTask">
<UploadFileResult>
<taskData>
<TaskID>47</TaskID>
<TaskState>Completed</TaskState>
</taskData>
</UploadFileResult>
</UploadFileResponse>
response2.xml
<UploadFileResponse xmlns="http://SharepointTask">
<UploadFileResult>
<taskData>
<TaskID>48</TaskID>
<TaskState>Completed</TaskState>
</taskData>
</UploadFileResult>
</UploadFileResponse>
Now, I want to apply XSLT and get the output as below
<UploadFileResponse xmlns="http://SharepointTask">
<UploadFileResult>
<taskData>
<TaskID>47</TaskID>
<TaskState>Completed</TaskState>
</taskData>
<taskData>
<TaskID>48</TaskID>
<TaskState>Completed</TaskState>
</taskData>
</UploadFileResult>
</UploadFileResponse>
I m not sure as to how to transform these two xmls and get the specific node out of it. I have basic idea of XSLT and any help would be appreciated.
You can use document to read in files. http://www.w3schools.com/xsl/func_document.asp
Yes, you can use the document() function to import in your xsl stylesheet a second xml file to parse (over the one that it's linked to stylesheet).
You ca do for example:
<xsl:variable name="response2"><xsl:value-of select="'response2.xml'"/></xsl:variable>
<xsl:value-of select="document($response2)//UploadFileResponse/UploadFileResult/taskData/TaskID"/>
This example will output 48.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.