首页 > 解决方案 > Xslt node exists for multiple elements

问题描述

I am a newbie to xslt and please forgive me if i missed any basics here.

I have an input, where i want to check whether an element/complexstrcuture exists or not. If it exists, i simply need to copy it else i need to create an empty tag. I am able to do it with the below xslt.

    <xsl:when test="cla:PublicID">
    <xsl:copy-of copy-namespaces="no" select="cla:PublicID"/>
    </xsl:when>
    <xsl:otherwise><cla:PublicID/></xsl:otherwise>
    </xsl:choose>

But I have around 2000 elements in the request comprising of both complex and simple elements. Hence i thought of writing a function which is not serving the purpose as well.

Is there any better way to do this using xslt templates or so?

I dont want to do the identity transform as I need to select part of request with this xslt and then popualte the elements.

Thanks!

标签: xmlxsltxsdxslt-2.0xml-validation

解决方案


推荐阅读