Subject: [xsl] why this stylesheet doesn't work properly? From: Auguste Oumar <oumar_a@xxxxxxxx> Date: Fri, 14 Sep 2001 15:49:05 +0200 (CEST) |
Hi, i have a xml-doc with the structure: <articleMasterData> <telegramNumber>...</telegramNumber> <client>...</client> <articleNumber>...</articleNumber> . . . </articleMasterData> I'm trying to output all the elements'content(from the elements telegramNumber,client etc...)in the order specified in the stylesheet below,in one single line(without line break) and with default values if the elements are not in the xml-file as specified in the stylesheet.Why the stylesheet below isn't able to accomplish that job ? thanks for help. <?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:for-each select="*"> <xsl:if test="AMD:telegramNumber"> <xsl:value-of select="."/> </xsl:if> <xsl:if test="AMD:client"> <xsl:variable name="mandant" select="."/> <xsl:number value="$mandant" format="00000000"/> </xsl:if> <xsl:if test="AMD:articleNumber"> <xsl:variable name="arNbr" select="."/> <xsl:value-of select="substring(concat($arNbr,' '),1,20)"/> </xsl:if> <xsl:if test="AMD:itemCode"> <xsl:variable name="iCode" select="."/> <xsl:value-of select="substring(concat($iCode,' '),1,30)"/> </xsl:if> <xsl:choose> <xsl:when test="AMD:itemCode2"> <xsl:variable name="iCode2" select="."/> <xsl:value-of select ="substring(concat($iCode2,' '),1,50)"/> </xsl:when> <xsl:otherwise> <xsl:text> </xsl:text> </xsl:otherwise> </xsl:choose> <xsl:choose> <xsl:when test="AMD:quantityPerPackingUnit"> <xsl:variable name="qppu" select="."/> <xsl:number value="$qppu" format="00000000"/> </xsl:when> <xsl:otherwise> <xsl:text>00000000</xsl:text> </xsl:otherwise> </xsl:choose> <xsl:if test="AMD:QPPU-Modus"> <xsl:value-of select="."/> </xsl:if> <xsl:if test="AMD:batchMode"> <xsl:value-of select="."/> </xsl:if> <xsl:if test="AMD:quantityUnit"> <xsl:variable name="qUnit" select="."/> <xsl:value-of select="substring(concat($qUnit,' '),1,2)"/> </xsl:if> <xsl:choose> <xsl:when test="AMD:deliveryReferenz"> <xsl:variable name="dRef" select="."/> <xsl:value-of select="substring(concat($dRef,' '),1,8)"/> </xsl:when> <xsl:otherwise> <xsl:text> </xsl:text> </xsl:otherwise> </xsl:choose> <xsl:if test="AMD:price"> <xsl:variable name="prix" select="."/> <xsl:number value="$prix" format="00000000"/> </xsl:if> <xsl:choose> <xsl:when test="AMD:weight"> <xsl:variable name="poids" select="."/> <xsl:number value="$poids" format="00000000"/> </xsl:when> <xsl:otherwise> <xsl:text>00000000</xsl:text> </xsl:otherwise> </xsl:choose> <xsl:choose> <xsl:when test="AMD:height"> <xsl:variable name="haut" select="."/> <xsl:number value="$haut" format="00000000"/> </xsl:when> <xsl:otherwise> <xsl:text>00000000</xsl:text> </xsl:otherwise> </xsl:choose> <xsl:choose> <xsl:when test="AMD:width"> <xsl:variable name="largeur" select="."/> <xsl:number value="$largeur" format="00000000"/> </xsl:when> <xsl:otherwise> <xsl:text>00000000</xsl:text> </xsl:otherwise> </xsl:choose> <xsl:choose> <xsl:when test="AMD:depth"> <xsl:variable name="profondeur" select="."/> <xsl:number value="$profondeur" format="00000000"/> </xsl:when> <xsl:otherwise> <xsl:text>00000000</xsl:text> </xsl:otherwise> </xsl:choose> <xsl:if test="AMD:bestBeforeDate"> <xsl:variable name="bbDate" select="."/> <xsl:number value="$bbDate" format="0000"/> </xsl:if> <xsl:choose> <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> <xsl:if test="AMD:actionCode"> <xsl:value-of select="."/> </xsl:if> </xsl:for-each> </xsl:template> </xsl:stylesheet> __________________________________________________________________ Do You Yahoo!? Gesendet von Yahoo! Mail - http://mail.yahoo.de XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] How do you get the non-tr, Michael Kay | Thread | Re: [xsl] why this stylesheet doesn, Jeni Tennison |
[no subject], Dmitri Ilyin | Date | Re: [xsl] XSL Javascript prob, Thomas B. Passin |
Month |