xml - 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!
解决方案
推荐阅读
- android - 使用 xamarin.forms.android 检测屏幕镜像
- arrays - 有没有办法在 Fortran 中使用数组作为另一个数组的地址
- php - 每个用户 api 的数据同步
- jmeter - 我可以用 2 个用户运行脚本,但不能用 jmeter 中的多个用户运行
- javascript - VueJS 路由参数对象
- redis - Redis XGROUP DELCONSUMER 。待处理的消息会发生什么?
- google-apps-script - Google Sheet 脚本未完全执行
- javascript - 一旦导航需要两行,如何显示移动菜单按钮?
- jquery - 未捕获的类型错误:jquery__WEBPACK_IMPORTED_MODULE_8___default(...)(...).modal 不是函数
- python - 如何使android应用程序作为服务器和python作为客户端