Voor een programma om kostenmodellen door te rekenen ben ik bezig een XSL te schrijven die de geexporteerde XML omzet naar een tab of comma-separated formaat. Als invoer heb ik dit bestand: http://dev.trag.nl/meuk/pgxml.xml. Ik gebruik de volgende XSL:
Als ik dit echter ga transformen met msxsl (standaard tooltje voor de MSXML sdk) krijg ik er dit uit:
Het gekke is, dat als ik als XSL het volgende gebruik, het nog steeds deze gekke tekst output:
Wat is hier aan de hand? Het laatste voorbeeld zou toch helemaal niets moeten outputten?
XML:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
| <?xml version='1.0' ?> <!-- This line tells the transformer what version of XSLT we're using --> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:qpr="www.qpr.com"> <xsl:strip-space elements="*" /> <!-- Tell the transformer that we're outputting text --> <xsl:output method="text" encoding="ASCII" version='1.0' omit-xml-declaration="no" media-type="text/plain" /> <!-- for each ModelElement.... --> <xsl:template match="ModelElement"> <!-- Flows only... --> <xsl:if test="substring(@TypeID,4,2)='FL'"> <!-- All text we want to output should be between xsl:text tags --> <xsl:text>__FLOW </xsl:text> <xsl:value-of select="@ElementName"/> <!-- tab --> <xsl:text> </xsl:text> <xsl:value-of select="Attribute[@AttributeName='From']/Record/Field[@Name='ElementName']/@Value"/> <!-- another tab --> <xsl:text> </xsl:text> <xsl:value-of select="Attribute[@AttributeName='To']/Record/Field[@Name='ElementName']/@Value"/> <!-- 
 is the code for a newline --> <xsl:text> </xsl:text> </xsl:if> <!-- objects only... --> <xsl:if test="substring(@TypeID,4,2)='PS' "> <xsl:text>__OBJECT </xsl:text> <xsl:value-of select="@ElementName"/> <xsl:value-of select="concat(' ',normalize-space(Attribute[@AttributeName='Description']/Value))"/> <xsl:text> </xsl:text> <xsl:value-of select="Attribute[@AttributeName='Organization items']/Record/Field[@Name='ElementName']/@Value"/> <xsl:text> </xsl:text> </xsl:if> </xsl:template> </xsl:stylesheet> |
Als ik dit echter ga transformen met msxsl (standaard tooltje voor de MSXML sdk) krijg ik er dit uit:
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
| Costitem 020falsetrue0d 00:00:000d 00:00:00ConstantConstantAny incoming flowAll outgoing flows0falseProduct 010falsetrue0d 00:00:000d 00:00:00ConstantConstantAn y incoming flowAll outgoing flows0falseProduct 020falsetrue0d 00:00:000d 00:00:0 0ConstantConstantAny incoming flowAll outgoing flows0falseResource 010falsetrue0 d 00:00:000d 00:00:00ConstantConstantAny incoming flowAll outgoing flows0falseRe source 020falsetrue0d 00:00:000d 00:00:00ConstantConstantAny incoming flowAll ou tgoing flows0falseActiviteit 010falsetrue0d 00:00:000d 00:00:00ConstantConstantA ny incoming flowAll outgoing flows0falseCostitem 010falsetrue0d 00:00:000d 00:00 :00ConstantConstantAny incoming flowAll outgoing flows0falsefalse0falseConstant0 d 00:00:00Constant0d 00:00:00false0false0falseConstant0d 00:00:00Constant0d 00:0 0:00false0false0falseConstant0d 00:00:00Constant0d 00:00:00false0false0falseCons tant0d 00:00:00Constant0d 00:00:00false0false0falseConstant0d 00:00:00Constant0d 00:00:00false0false0falseConstant0d 00:00:00Constant0d 00:00:00false0Single Val ueNoned hh:mm:ssfalsetrueSingle ValueNone1234.57$falsetrueStart and End ValueNon edd/MM/yyyy hh:mm:ssfalsetrueSingle ValueNone1234.57$falsetrue[Empty][Empty][Emp ty][Empty]Other00000000d 00:00:00Hour |
Het gekke is, dat als ik als XSL het volgende gebruik, het nog steeds deze gekke tekst output:
XML:
1
2
3
4
5
6
7
8
9
| <?xml version='1.0' ?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:qpr="www.qpr.com"> <xsl:template match="/"> <xsl:apply-templates/> </xsl:template> </xsl:stylesheet> |
Wat is hier aan de hand? Het laatste voorbeeld zou toch helemaal niets moeten outputten?
edit:
tot zover de layout....
tot zover de layout....
[ Voor 13% gewijzigd door MisterData op 07-07-2003 15:25 ]