pretty-print

XML to XML transformation with XSLT in Firefox and IE

给你一囗甜甜゛ 提交于 2019-12-07 14:03:01
问题 I did a transformation from few XML formats to one standard. My XSL looks like following one: <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"> <xsl:output method="xml" encoding="UTF-8" indent="yes" omit-xml-declaration="yes"/> <xsl:template match="list | store"> <list> <xsl:for-each select="item | product | product-store"> <item> <name> <xsl:choose> <xsl:when test="name"><xsl:value-of select="substring-before(name, ' ')" />

PHP SimpleXML new line

左心房为你撑大大i 提交于 2019-12-07 00:21:43
问题 I have created a XML file using PHP's simple XML, saved the file. When opening the file in php using fopen and printing the contents. my XML looks like this: (see below) <?xml version="1.0" encoding="UTF-8"?> <home><orderList><delivery_cost>0.00</delivery_cost><delivery_surname>TEST</delivery_surname><delivery_postcode>1234</delivery_postcode><status>1</status></orderList></home> I want the xml file looking all indented and on new lines for each element. Does anybody know how to do this?

How to make XML strings bold, underlined etc?

流过昼夜 提交于 2019-12-06 18:28:11
问题 http://docs.fusioncharts.com/charts/contents/Styles/Font.html I tried this, along with a lot of things but failed to do so. Here's what I want. <string name="ss">Bold. Underlined. Italic. Big. Small</string> I want to format a little bit of the string. Where it's written bold, I want it to be bold...and same for others. I tried a lot of tags ...but well nothing worked, and I couldn't find anything on Google or SO. I know how to do it in a textview, but that's not what I want... I'm sending

How do I pretty-print a table in Haskell?

时光毁灭记忆、已成空白 提交于 2019-12-06 17:12:47
问题 I would like to prettyprint a table-like data structure in Haskell (a list of columns). For example... Table [ StrCol "strings" ["a", "bc", "c"], IntCol "ints" [1, 30, -2], DblCol "doubles" [2.0, 4.5, -3.2]] Should render something like... strings ints doubles "a" 1 2.0 "bc" 30 4.5 "c" -2 -3.2 Currently I have implemented this functionality in Text.PrettyPrint that comes with the most recent version of the Haskell Platform. Unfortunately the <+> operator orients multi-line documents

Is there a pretty printing (or showing) abstraction in Haskell?

我与影子孤独终老i 提交于 2019-12-06 04:33:52
Is there no standard way to print out values for end-user consumption? Show is clearly more of a debugging convenience than something that would work for this purpose, given the conventions around its use and the constraint that read (show x) == x . For example, isn't there at least a simple package like class (Show a) => PShow a where pshow :: a -> String pshow = show pprint :: (PShow a) => a -> IO () pprint = putStrLn . pshow where instances do something like instance PShow MyType where pshow a = someUserFriendlyStringOf a Note that I'm not asking for something that provides elaborate pretty

Printed length of a string in python

最后都变了- 提交于 2019-12-06 01:31:21
问题 Is there any way to find (even a best guess) the "printed" length of a string in python? E.g. 'potaa\bto' is 8 characters in len but only 6 characters wide printed on a tty. Expected usage: s = 'potato\x1b[01;32mpotato\x1b[0;0mpotato' len(s) # 32 plen(s) # 18 回答1: At least for the ANSI TTY escape sequence, this works: import re strip_ANSI_pat = re.compile(r""" \x1b # literal ESC \[ # literal [ [;\d]* # zero or more digits or semicolons [A-Za-z] # a letter """, re.VERBOSE).sub def strip_ANSI(s

Pretty Print Excel Formulas?

可紊 提交于 2019-12-06 01:12:45
问题 Does anyone know of a (free) tool to pretty print Excel formulas? A Google search didn't turn anything up. I've got a few worksheets of semi-complex formulas to slog through, so this would make my life a bit easier. I'm just looking to turn something like this AC6+AD6+(IF(H6="Yes",1,IF(J6="Yes",1,0)))+IF(X6="Yes",1,0) into something more readable without manually doing it in Vim or the like. Excel does do color-matching on the parentheses, but it's still all mashed together on one line. 回答1:

XML to XML transformation with XSLT in Firefox and IE

穿精又带淫゛_ 提交于 2019-12-05 21:34:45
I did a transformation from few XML formats to one standard. My XSL looks like following one: <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"> <xsl:output method="xml" encoding="UTF-8" indent="yes" omit-xml-declaration="yes"/> <xsl:template match="list | store"> <list> <xsl:for-each select="item | product | product-store"> <item> <name> <xsl:choose> <xsl:when test="name"><xsl:value-of select="substring-before(name, ' ')" /></xsl:when> <xsl:otherwise><xsl:value-of select="name | title" /></xsl:otherwise> </xsl:choose> </name>

pretty printing nested vectors

纵然是瞬间 提交于 2019-12-05 18:55:47
I have the following code to pretty-print generic vectors -: // print a vector template<typename T1> std::ostream& operator <<( std::ostream& out, const std::vector<T1>& object ) { out << "["; if ( !object.empty() ) { std::copy( object.begin(), --object.end(), std::ostream_iterator<T1>( out, ", " ) ); out << *--object.end(); // print the last element separately to avoid the extra characters following it. } out << "]"; return out; } I am getting a compiler error if I try to print a nested vector from it. int main() { vector<vector<int> > a; vector<int> b; // cout << b ; // Works fine for this

C#: “Pretty” type name function?

耗尽温柔 提交于 2019-12-05 12:55:18
问题 The name properties of System.Type class return a strange result in case of generic types. Is there a way to get the type name in a format closer to the way I specified it? Example: typeof(List<string>).OriginalName == "List<string>" 回答1: The problem with "pretty" names is they are different depending on the language you are using. Imagine the surprise of a VB.NET developer if OriginalName returned C# syntax. However, it's pretty fairly easy to make this yourself: private static string