Skip to content Skip to sidebar Skip to footer

Transforming Xml File To Html File Using Xsl

My requirement is like the following, 1. Upload one xml file in a webpage 2. Parse the uploaded xml using xsl file 3. Show the result in html table in the same webpage. But I c

Solution 1:

This is most likely a namespace issue (like). For a first test try to remove the default namespace xmlns="http://www.smpte-ra.org/schemas/430-3/2006/ETM" form your xml.

If this works but should not be the final solution you need to add the namespace with an prefix to your xslt xmlns:x="http://www.smpte-ra.org/schemas/430-3/2006/ETM" and use this prefix in your xpaht.

For example:

<td><xsl:value-ofselect="/x:DCinemaSecurityMessage/x:AuthenticatedPublic/x:IssueDate" /></td>

Update: Please consider that KDMRequiredExtensions has also a default namespace (xmlns="http://www.smpte-ra.org/schemas/430-1/2006/KDM) Therefor use kdm:KDMRequiredExtensions

<xsl:value-ofselect="/x:DCinemaSecurityMessage
           /x:AuthenticatedPublic
           /x:RequiredExtensions
           /kdm:KDMRequiredExtensions
           /kdm:ContentTitleText" />

Update doe to additional question in comment: Q: but how can we identify this namespace can be used for this element? Each xml node can have it own (new) default namespace xmlns="/url/". This namespace is than uses for this node and any children node (but could be changed again) In your example ContentTitleText has no default namespace declaration therefore the one from the parent is still valid. In your xslt you need to have a for each of this namespaces a namespace declaration with prefix and than you have to use this prefix.

Post a Comment for "Transforming Xml File To Html File Using Xsl"