Subject: RE: [xsl] outputing elements correctly . From: "Michael Kay" <mhkay@xxxxxxxxxxxx> Date: Sat, 15 Sep 2001 19:14:01 +0100 |
What processor are you using? Mike Kay > -----Original Message----- > From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx > [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of > Auguste Oumar > Sent: 13 September 2001 16:14 > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx > Subject: RE: [xsl] outputing elements correctly . > > > Hi Mike, > > > It looks OK to me, for example > > > <xsl:when test="AMD:pickingSequence"> > > > <xsl:variable name="pseq" select="."/> > > > <xsl:number value="$pseq" format="00"/> > > > </xsl:when> > > > <xsl:otherwise> > > > <xsl:text>00</xsl:text> > > > </xsl:otherwise> > > > </xsl:choose> > > > > should output 00 if the element is absent, and > > indeed it does. > is not quite correct!See the output below: > > 001100 > 000000001234556 > 123456oumar > Hamburg-Germany > 12345678 > 4 > 5 > Pa > 00000089 > 134 > 65 > 15 > 00000767 > 00000987 > 20 > 7 > 2 > 00000000 > > > > > 001100 > 00000 > > > > > 001100 > 000000001234556 > 00000000 > > > > > 001100 > 000000001234556 > 123456oumar > Hamburg-Germany > 12345678 > 4 > 5 > Pa > 00000089 > 134 > 65 > 15 > 00000767 > 00000987 > 20 > 7 > 2 > > > > > > 001100 > 000000001234556 > 123456oumar > Hamburg-Germany > 12345678 > 4 > 5 > Pa > 00000089 > 134 > 65 > 15 > 00000767 > 00000987 > 20 > 7 > 2 > > > > > > > > 00000000000000000000000000000000000000000000000 > > > > > 001100 > 000000001234556 > 123456oumar > Hamburg-Germany > 12345678 > 4 > 5 > Pa > 00000089 > 134 > 65 > 15 > 00000767 > 00000987 > 20 > 7 > 2 > Obviously we have several output of the same xml-file! > We should only have one,and it should look like this: > 001100123456 123456oumar Hamburg-Germany > 0000087...etc on a single line and with all > elements.As you can see the default values weren't > outputed(compare with xml-file and stylesheet).I hope > this help you understand the problem. > > Cheers > > > > > In fact, the stylesheet appears to do exactly what > > you say you want. If this > > isn't what you actually want, then you need to > > describe your requirements > > more clearly. > > > > (Of course you can simplify lines 2+3 to <xsl:number > > value="." format="00"/> > > > > Mike Kay > > > > > > Thanks. > > > Auguste > > > > > > Xml-file: > > > <?xml version="1.0" encoding="ISO-8859-1"?> > > > > > > <articleMasterData > > > xmlns="http://www.Artikelstammdaten.org" > > > > > > > > > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > > > > > > > > xsi:schemaLocation="http://www.Artikelstammdaten.org > > > ArticleMaDaSch.xsd"> > > > > > > <?xml-stylesheet type="text/xsl" > > > href="ArticleMaDaXmlToHtml.xsl"?> > > > <?xml-stylesheet type="text/xsl" > > > href="ArticleMaDaXmlToAscii.xsl"?> > > > > > > <telegramNumber>001100</telegramNumber> > > > <client>123</client> > > > <articleNumber>123456oumar</articleNumber> > > > <itemCode>Hamburg-Germany</itemCode> > > > > > > > > > <quantityPerPackingUnit>12345678</quantityPerPackingUnit> > > > <QPPU-Modus>4</QPPU-Modus> > > > <batchMode>5</batchMode> > > > <quantityUnit>Pa</quantityUnit> > > > <deliveryReferenz>00000089</deliveryReferenz> > > > <price>134</price> > > > <weight>65</weight> > > > <height>15</height> > > > <width>00000767</width> > > > <depth>00000987</depth> > > > <bestBeforeDate>20</bestBeforeDate> > > > <pickingSequence>7</pickingSequence> > > > <actionCode>2</actionCode> > > > </articleMasterData> > > > > > > Stylesheet with templates: > > > > > > <?xml version="1.0" encoding="ISO8859-1"?> > > > <xsl:stylesheet version="1.0" > > > xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > > > > > > xmlns:AMD="http://www.Artikelstammdaten.org" > > > > > xmlns="http://www.w3.org/TR/REC-html40"> > > > > > > <xsl:output method="text"/> > > > <xsl:strip-space elements="*"/> > > > > > > <xsl:template match="/"> > > > <xsl:apply-templates/> > > > </xsl:template> > > > > > > <xsl:template match="AMD:articleMasterData"> > > > <xsl:apply-templates/> > > > </xsl:template> > > > > > > <xsl:template match="AMD:telegramNumber"> > > > <xsl:value-of select="."/></xsl:template> > > > > > > <xsl:template match="AMD:client"> > > > <xsl:variable name="mandant" select="."/> > > > <xsl:number value="$mandant" > > > format="00000000"/></xsl:template> > > > > > > <xsl:template match="AMD:articleNumber"> > > > <xsl:variable name="arNbr" select="."/> > > > <xsl:value-of select="substring(concat($arNbr,' > > > '),1,20)"/></xsl:template> > > > > > > > > > <xsl:template match="AMD:itemCode"> > > > <xsl:variable name="iCode" select="."/> > > > <xsl:value-of select="substring(concat($iCode,' > > > '),1,30)"/></xsl:template> > > > > > > <xsl:template match="AMD:itemCode2"> > > > <xsl:variable name="iCode2" select="."/> > > > <xsl:value-of select ="substring(concat($iCode2,' > > > > > > '),1,50)"/></xsl:template> > > > > > > > > > <xsl:template match="AMD:quantityPerPackingUnit"> > > > <xsl:variable name="qppu" select="."/> > > > <xsl:number value="$qppu" > > > format="00000000"/></xsl:template> > > > > > > > > > <xsl:template match="AMD:QPPU-Modus"> > > > <xsl:value-of select="."/></xsl:template> > > > > > > <xsl:template match="AMD:batchMode"> > > > <xsl:value-of select="."/></xsl:template> > > > > > > <xsl:template match="AMD:quantityUnit"> > > > <xsl:variable name="qUnit" select="."/> > > > <xsl:value-of select="substring(concat($qUnit,' > > > '),1,2)"/></xsl:template> > > > > > > <xsl:template match="AMD:deliveryReferenz"> > > > <xsl:variable name="dRef" select="."/> > > > <xsl:value-of select="substring(concat($dRef,' > > > '),1,8)"/></xsl:template> > > > > > > <xsl:template match="AMD:price"> > > > <xsl:variable name="prix" select="."/> > > > <xsl:number value="$prix" > > > format="00000000"/></xsl:template> > > > > > > <xsl:template match="AMD:weight"> > > > <xsl:variable name="poids" select="."/> > > > <xsl:number value="$poids" > > > format="00000000"/></xsl:template> > > > > > > <xsl:template match="AMD:height"> > > > <xsl:variable name="haut" select="."/> > > > <xsl:number value="$haut" > > > format="00000000"/></xsl:template> > > > > > > <xsl:template match="AMD:width"> > > > <xsl:variable name="largeur" select="."/> > > > <xsl:number value="$largeur" > > > format="00000000"/></xsl:template> > > > > > > <xsl:template match="AMD:depth"> > > > <xsl:variable name="profondeur" select="."/> > > > <xsl:number value="$profondeur" > > > format="00000000"/></xsl:template> > > > > > > <xsl:template match="AMD:bestBeforeDate"> > > > <xsl:variable name="bbDate" select="."/> > > > <xsl:number value="$bbDate" > > > format="0000"/></xsl:template> > > > > > > <xsl:template match="AMD:pickingSequence"> > > > <xsl:variable name="pseq" select="."/> > > > <xsl:number value="$pseq" > > > format="00"/></xsl:template> > > > > > > <xsl:template match="AMD:actionCode"> > > > <xsl:value-of select="."/></xsl:template> > > > > > > </xsl:stylesheet> > > > > > > stylesheet without template(doesn't work > > properly): > > > > > > <?xml version="1.0" encoding="ISO8859-1"?> > > > <xsl:stylesheet version="1.0" > > > xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > > > > > > xmlns:AMD="http://www.Artikelstammdaten.org" > > > > > xmlns="http://www.w3.org/TR/REC-html40"> > > > === message truncated === > > __________________________________________________________________ > Do You Yahoo!? > Gesendet von Yahoo! Mail - http://mail.yahoo.de > > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] outputing elements correc, Auguste Oumar | Thread | RE: [xsl] outputing elements correc, Auguste Oumar |
[xsl] RE:, Carlos Fragoso Maris | Date | RE: [xsl] Extracting a list of uniq, Michael Kay |
Month |