xslt - modify xml node value or attribute value with xsl without specifying -


i working on project modifies xml documents. want modify either node value or attribute value. able if specify it's node or attribute value want modify. modifying node value in xsl:

<xsl:template match="xpath/text()">newvalue</xsl:template> 

modifying attribute value in xsl:

<xsl:template match="xpath">   <xsl:attribute name="attributename">newvalue</xsl:attribute> </xsl:template> 

but want modify values without specifying node or attribute. example here short xml:

<example>   <test>     <node attrname="oldattrvalue">       oldnodevalue     </node>   </test> </example> 

i modify "attrname" attribute value or "node" node value without specifying which. somehow possible, maybe xpath?

thank you.

i modify "attrname" attribute value or "node" node value without specifying which. somehow possible

if understand question correctly (which not @ certain) answer no.

keep in mind text contained in element node of own1, , such can selected xpath expression or matched template's match pattern. attribute node, - value of attribute not - , therefore cannot selected or matched on own.

see also: http://www.w3.org/tr/xpath/#data-model

--
(1) more precisely: each span of text contained element separately addressable node.


Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -