java - Fetch an XML node-name as regex in XSL Stylesheet transformation -


i have xml (i know incorrect per xml standards restricted changes processing response external party) follows,

 xml snippet : <root>                  <3party>some_value</3party>                </root> 

i fetch <3party> above snippet in xsl stylesheet transformation. fact <3party> element invalid can no refer follows fails xsl compilation. need way refer partial element may using regx way? following incorrect.

   <xsl:variable select="$response/root/3party" /> 

any answers me out.

edit : possible solution above usecase be.

<xsl:for-each select="$response/root">     <!-- node name -->          <xsl:variable name="name" select="local-name()" />      <!-- check if contains party -->          <xsl:if test="contains($name, 'party')">              <!-- node value -->              <xsl:variable name="value" select="node()" />          </xsl:if> </xsl:for-each> 

with regard code added question:

<xsl:for-each select="$response/root">     <!-- node name -->          <xsl:variable name="name" select="local-name()" />      <!-- check if contains party -->          <xsl:if test="contains($name, 'party')">              <!-- node value -->              <xsl:variable name="value" select="node()" />          </xsl:if> </xsl:for-each> 

the test contains($name, 'party') never return true. context node's name root , "root" not contain "party".


on more general note: seem think problem how xslt stylesheet compile. not so. real problem here input not well-formed xml. input must parsed before can transformed, , if it's not well-formed xml, process fail before considering stylesheet.


Comments

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -