I am new to using XSLT. I want to display all of the information in an xml tag in my xsl formatted page. I have tried using local-name, name, etc and none give me the result I want.
Example:
 <step bar=开发者_如何转开发"a" bee="localhost" Id="1" Rt="00:00:03" Name="hello">Pass</step>
I would like to be able to print out all of the information (bar="a", bee="localhost") etc as well as the value of <step> Pass.
How can I do this with xsl?
Thank you!
If you want to return just the values, you could use the XPath //text()|@*.
If you want the attribute/element names along with the values, you could use this stylesheet:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:output method="text"/>
  <xsl:strip-space elements="*"/>
  <xsl:template match="*">
    <xsl:apply-templates select="node()|@*"/>
  </xsl:template>
  <xsl:template match="text()">
    <xsl:value-of select="concat('<',name(parent::*),'> ',.,'
')"/>
  </xsl:template>
  <xsl:template match="@*">
    <xsl:value-of select="concat(name(),'="',.,'"
')"/>
  </xsl:template>
</xsl:stylesheet>
With your input, it will produce this output:
bar="a"
bee="localhost"
Id="1"
Rt="00:00:03"
Name="hello"
<step> Pass
<xsl:for-each select="attribute::*">   
  <xsl:value-of select="text()" />   
  <xsl:value-of select="local-name()" />   
</xsl:for-each>
<xsl:value-of select="text()" />   
<xsl:value-of select="local-name()" />   
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论