English 中文(简体)
三. 小型电离层转变的特性之间的保留白色空间
原标题:Preserve whitespace between attributes in XSLT transformation
  • 时间:2012-01-13 16:23:00
  •  标签:
  • xml
  • xslt

我有以下XML:

<?xml version="1.0"?>
<products>
    <product at1="a"
             at2="b"
             at3="c">
    </product>
</products>

and the following XSLT:

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

    <xsl:template match="@*|node()">
            <xsl:copy>
                    <xsl:apply-templates select="@*|node()"/>
            </xsl:copy>
    </xsl:template>

</xsl:stylesheet>

In theory, the xslt should leave the input xml unchanged. However, the output I get after processing is:

<?xml version="1.0"?>
<products>
    <product at1="a" at2="b" at3="c">
    </product>
</products>

难道我可以阻止变换者重新调整特性之间的间隔。 我的理解是,投入和产出xml在功能上都是等同的,但为了人类可读性的目的,我谨保留每一行状的属性。 如果有的话,Im利用ubuntu sxsltproc进行这一转变:

xsltproc -o test2.xml test.xslt test.xml
问题回答

无,没有标准XML/XSLT工具。

这些信息不属于《反洗钱法》的惯用部分,在《反洗钱法》被XML教区阅读时将丢失。 因此,不能保留产出。

你们需要用其他办法修改产出,以采用这种格式。





相关问题
how to represent it in dtd?

I have two element action and guid. guid is a required field when action is add. but when action is del it will not appear in file. How to represent this in dtd ?

.Net application configuration add xml-data

I need to add xml-content to my application configuration file. Is there a way to add it directly to the appSettings section or do I need to implement a configSection? Is it possible to add the xml ...

XStream serializing collections

I have a class structure that I would like to serialize with Xstream. The root class contains a collection of other objects (of varying types). I would like to only serialize part of the objects that ...

MS Word splits words in its XML format

I have a Word 2003 document saved as a XML in WordProcessingML format. It contains few placeholders which will be dynamically replaced by an appropriate content. But, the problem is that Word ...

Merging an XML file with a list of changes

I have two XML files that are generated by another application I have no control over. The first is a settings file, and the second is a list of changes that should be applied to the first. Main ...

How do I check if a node has no siblings?

I have a org.w3c.dom.Node object. I would like to see if it has any other siblings. Here s what I have tried: Node sibling = node.getNextSibling(); if(sibling == null) return true; else ...

Ordering a hash to xml: Rails

I m building an xml document from a hash. The xml attributes need to be in order. How can this be accomplished? hash.to_xml

热门标签