以文本方式查看主题 - 中文XML论坛 - 专业的XML技术讨论区 (http://bbs.xml.org.cn/index.asp) -- 『 XSL/XSLT/XSL-FO/CSS 』 (http://bbs.xml.org.cn/list.asp?boardid=8) ---- 请求帮助,万分感谢。 (http://bbs.xml.org.cn/dispbbs.asp?boardid=8&rootid=&id=29549) |
-- 作者:jamingding -- 发布时间:3/30/2006 2:18:00 AM -- 请求帮助,万分感谢。 请高手把我的文件看一下。我的遇到的问题是空格和换行的显示问题。想显示多个空格和换行,但是弄来弄去只有一个空格有效。试了很多方法,都没用,不知道这个问题应该怎么解决的。xml:space="preserve"已经用了,xsl:preserve-space属性也用了,但都没有效果。请高手帮忙。xml和xsl文件如下: cd_xml: <?xml version="1.0" encoding="GB2312" ?> <?xml-stylesheet type="text/xsl" href="cd_catalog.xsl"?> <MESSAGES> <MESSAGES> <DATE>2006年3月28</DATE> <TO>毛泽东</TO> <FROM>北京</FROM> <SUBJECT>北京好啊,北京好</SUBJECT> <BODY>我爱 北京天安门,天安门上太阳升。我爱北京天安门,天安门上太阳升。我爱北京天安门,天安门上太阳升。我爱北京天安门,天安门上太阳升。 我爱北京天安门,天安门上太阳升。我爱北京天安门,天安门上太阳升。我爱北京天安门,天安门上太阳升。我爱北京天安门,天安门上太阳升。 我爱北京天安门,天安门上太阳升。我爱北京天安门,天安门上太阳升。我爱北京天安门,天安门上太阳升。</BODY> </MESSAGES> <MESSAGES> <DATE>2006年3月28日</DATE> <TO>江泽民</TO> <FROM>北京</FROM> <SUBJECT>同志们好</SUBJECT> <BODY xml:space="preserve">同 志们,同志们辛苦了。为人民服务。同志们,同志们辛苦了。为人民服务。同志们,同志们辛苦了。为人民服务。同志们,同志们辛苦了。为人民服务。同志们,同志们辛苦了。为人民服务。 同志们,同志们辛苦了。为人民服务。同志们,同志们辛苦了。为人民服务。同志们,同志们辛苦了。为人民服务。 同志们,同志们辛苦了。为人民服务</BODY> </MESSAGES> </MESSAGES>
cd_catalog.xsl: |
-- 作者:Qr -- 发布时间:3/30/2006 12:30:00 PM -- 空格: &#160; 或 <xsl:text>空格</xsl:text> |
-- 作者:gdcl -- 发布时间:2/3/2008 10:23:00 AM -- 空格: &#160; 或 <xsl:text>空格</xsl:text> 这些都用了,空格还是没有保留,因为我只输出单单一个空格,哪位还有什么方法吗?急。 |
-- 作者:孤独 -- 发布时间:2/3/2008 2:07:00 PM -- &nbsp; |
-- 作者:gdcl -- 发布时间:2/4/2008 2:54:00 PM -- 这些都试过了,还是没用?如果是" a b " ,结果是" a b ",但如果只是单单输出一个空格" ",它的结果是没有这个空格,试过很多方法不行? |
-- 作者:孤独 -- 发布时间:2/4/2008 5:48:00 PM -- <xsl:text disable-output-escaping="yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</xsl:text> |
-- 作者:孤独 -- 发布时间:2/4/2008 5:50:00 PM -- 再跟你说个大招 ,这些空格你随便复制哈, |
-- 作者:gdcl -- 发布时间:2/5/2008 11:14:00 AM -- 这些都试过了,没有用..还有什么方法吗? |
-- 作者:gdcl -- 发布时间:2/5/2008 11:19:00 AM -- <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method="xml" indent="yes"/> <xsl:preserve-space elements="*"/> <xsl:key name="by-header" match="ROW" use="concat(INST_CODE, '_', PO_NMBR, '_', VENDOR_EAN)"/> <xsl:key name="by-line" match="ROW" use="concat(INST_CODE, '_', PO_NMBR, '_', VENDOR_EAN, '_', PO_LINE, '_', ITEM_UPN, '_', UPN_TYPE)"/> <xsl:template match="ROWSET"> <Message-ORDERS xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.edifecs.com/xdata/100 guideline.xsd" XDataVersion="1.0" Standard="PFF" Version=""> <xsl:attribute name="CreatedDate"> <xsl:value-of select="CURRENT_DATETIME"/> </xsl:attribute> <xsl:attribute name="GUID"> <xsl:value-of select="GUID"/> </xsl:attribute> <Internal-Properties> <Data-Structure Name="Message"> <Property Name="RecordDelimiter">0xd0xa</Property> </Data-Structure> </Internal-Properties> <xsl:for-each select="ROW[generate-id() = generate-id(key('by-header', concat(INST_CODE, '_', PO_NMBR, '_', VENDOR_EAN))[1])]"> <Record-UNH> <Field-UNH>UNH</Field-UNH> <Field-BGM_C002_1001>220</Field-BGM_C002_1001> <Field-BGM_C002_1000/> <Field-BGM_1004> <xsl:value-of select="//PO_NMBR"/> </Field-BGM_1004> <Field-BGM_1225>9</Field-BGM_1225> <Field-BGM_4343>NA</Field-BGM_4343> <Field-UNB_S002_0004>4895063300015</Field-UNB_S002_0004> <Field-UNB_S003_0010> <xsl:value-of select="//VENDOR_EAN"/> </Field-UNB_S003_0010> <Field-UNB_S002_0008/> <Field-UNB_S003_0014><xsl:value-of select="translate(//EMPTY_SPACE,'a',' ')"/><xsl:text xml:space="preserve" disable-output-escaping="yes"> </xsl:text></Field-UNB_S003_0014> </Record-UNH> <Record-DTM> <Field-DTM>DTM</Field-DTM> <Field-DTM_C507_2005>137</Field-DTM_C507_2005> <Field-DTM_C507_2380> <xsl:value-of select="//PO_DATE"/> </Field-DTM_C507_2380> <Field-DTM_C507_2379>102</Field-DTM_C507_2379> </Record-DTM> <xsl:if test="normalize-space(//HEADER_REMARK) > ''"> <Record-FTX_> <Field-FTX>FTX</Field-FTX> <Field-FTX_4451>ZZZ</Field-FTX_4451> <Field-FTX_C108_4440> <xsl:value-of select="//HEADER_REMARK"/> </Field-FTX_C108_4440> <Field-FTX_C108_4440_2/> <Field-FTX_C108_4440_3/> <Field-FTX_C108_4440_4/> <Field-FTX_C108_4440_5/> <Field-FTX_3453><xsl:value-of select="//EMPTY_SPACE"/></Field-FTX_3453> </Record-FTX_> </xsl:if> <GroupRecord-Group_1> <Record-G02NAD> <Field-G02NAD>G02NAD</Field-G02NAD> <Field-G02NAD_3035>BY</Field-G02NAD_3035> <Field-G02NAD_C082_3039>4895063300015</Field-G02NAD_C082_3039> <Field-G02NAD_C080_3036/> <Field-G02NAD_C080_3036_2/> <Field-G02NAD_C059_3042/> <Field-G02NAD_C059_3042_2/> <Field-G02NAD_C059_3042_3/> <Field-G02NAD_3164/> <Field-G02NAD_3229/> <Field-G02NAD_3251/> <Field-G02NAD_3207/> <Field-G02NAD_C082_3055>9</Field-G02NAD_C082_3055> <Field-G02NAD_C080_3036_3/> <Field-G02NAD_C080_3036_4/> <Field-G02NAD_C080_3036_5/> <Field-G02NAD_C080_3045/> <Field-G02NAD_C059_3042_4><xsl:value-of select="//EMPTY_SPACE"/></Field-G02NAD_C059_3042_4> </Record-G02NAD> </GroupRecord-Group_1> <GroupRecord-Group_1> <Record-G02NAD> <Field-G02NAD>G02NAD</Field-G02NAD> <Field-G02NAD_3035>SU</Field-G02NAD_3035> <Field-G02NAD_C082_3039> <xsl:value-of select="//VENDOR_EAN"/> </Field-G02NAD_C082_3039> <Field-G02NAD_C080_3036/> <Field-G02NAD_C080_3036_2/> <Field-G02NAD_C059_3042/> <Field-G02NAD_C059_3042_2/> <Field-G02NAD_C059_3042_3/> <Field-G02NAD_3164/> <Field-G02NAD_3229/> <Field-G02NAD_3251/> <Field-G02NAD_3207/> <Field-G02NAD_C082_3055>9</Field-G02NAD_C082_3055> <Field-G02NAD_C080_3036_3/> <Field-G02NAD_C080_3036_4/> <Field-G02NAD_C080_3036_5/> <Field-G02NAD_C080_3045/> <Field-G02NAD_C059_3042_4/> </Record-G02NAD> </GroupRecord-Group_1> <GroupRecord-Group_1> <Record-G02NAD> <Field-G02NAD>G02NAD</Field-G02NAD> <Field-G02NAD_3035>DP</Field-G02NAD_3035> <Field-G02NAD_C082_3039> <xsl:value-of select="//HEADER_DELIVERY_LOC_EAN"/> </Field-G02NAD_C082_3039> <Field-G02NAD_C080_3036/> <Field-G02NAD_C080_3036_2/> <Field-G02NAD_C059_3042/> <Field-G02NAD_C059_3042_2/> <Field-G02NAD_C059_3042_3/> <Field-G02NAD_3164/> <Field-G02NAD_3229/> <Field-G02NAD_3251/> <Field-G02NAD_3207/> <Field-G02NAD_C082_3055>9</Field-G02NAD_C082_3055> <Field-G02NAD_C080_3036_3/> <Field-G02NAD_C080_3036_4/> <Field-G02NAD_C080_3036_5/> <Field-G02NAD_C080_3045/> <Field-G02NAD_C059_3042_4/> </Record-G02NAD> </GroupRecord-Group_1> <xsl:choose> <xsl:when test="normalize-space(//CURRENCY)!='HKD'"> <Record-G07CUX> <Field-G07CUX_C504_6347>2</Field-G07CUX_C504_6347> <Field-G07CUX_C504_6345> <xsl:value-of select="//CURRENCY"/> </Field-G07CUX_C504_6345> <Field-G07CUX_C504_6343/> <Field-G07CUX_C504_6348/> </Record-G07CUX> </xsl:when> </xsl:choose> <Record-G11TOD> <Field-G11TOD>G11TOD</Field-G11TOD> <Field-G11TOD_4055>10E</Field-G11TOD_4055> <Field-G11TOD_C100_4052/> <Field-G11TOD_C100_4052_2/> <Field-G11TOD_4215/> <Field-G11TOD_C100_4053> <xsl:value-of select="//TERMS_OF_DELIVERY"/> </Field-G11TOD_C100_4053> <Field-G11TOD_C100_1131/> <Field-G11TOD_C100_3055/> </Record-G11TOD> <xsl:for-each select="//ROW[generate-id() = generate-id(key('by-line', concat(INST_CODE, '_', PO_NMBR, '_', VENDOR_EAN, '_', PO_LINE, '_', ITEM_UPN, '_', UPN_TYPE))[1])]"> <GroupRecord-Group_5> <xsl:choose> <xsl:when test="normalize-space(UPN_TYPE)!='EN'"> <Record-G25LIN> <Field-G25LIN>G25LIN</Field-G25LIN> <Field-G25LIN_1082> <xsl:value-of select="PO_LINE"/> </Field-G25LIN_1082> <Field-G25LIN_C212_7140/> <Field-G25LIN_C212_7143/> </Record-G25LIN> <Record-G25PIA> <Field-G25PIA>G25PIA</Field-G25PIA> <Field-G25PIA_4347>5</Field-G25PIA_4347> <Field-G25PIA_C212_7140> <xsl:value-of select="ITEM_UPN"/> </Field-G25PIA_C212_7140> <Field-G25PIA_C212_7143> <xsl:value-of select="UPN_TYPE"/> </Field-G25PIA_C212_7143> <Field-G25PIA_C212_3055/> </Record-G25PIA> </xsl:when> <xsl:otherwise> <Record-G25LIN> <Field-G25LIN>G25LIN</Field-G25LIN> <Field-G25LIN_1082> <xsl:value-of select="PO_LINE"/> </Field-G25LIN_1082> <Field-G25LIN_C212_7140> <xsl:value-of select="ITEM_UPN"/> </Field-G25LIN_C212_7140> <Field-G25LIN_C212_7143>EN</Field-G25LIN_C212_7143> </Record-G25LIN> </xsl:otherwise> </xsl:choose> <Record-G25QTY> <Field-G25QTY>G25QTY</Field-G25QTY> <xsl:choose> <xsl:when test="number(UNIT_PRICE)=0"> <Field-G25QTY_C186_6063>192</Field-G25QTY_C186_6063> </xsl:when> <xsl:otherwise> <Field-G25QTY_C186_6063>21</Field-G25QTY_C186_6063> </xsl:otherwise> </xsl:choose> <Field-G25QTY_C186_6060> <xsl:value-of select="QUANTITY"/> </Field-G25QTY_C186_6060> <Field-G25QTY_C186_6411/> </Record-G25QTY> <xsl:call-template name="loop"> <xsl:with-param name="freetext"> <xsl:value-of select="normalize-space(LINE_REMARK)"/> </xsl:with-param> </xsl:call-template> <xsl:choose> <xsl:when test="number(UNIT_PRICE)!=0"> <Record-G28PRI> <Field-G28PRI>G28PRI</Field-G28PRI> <Field-G28PRI_C509_5125>AAA</Field-G28PRI_C509_5125> <Field-G28PRI_C509_5118> <xsl:value-of select="UNIT_PRICE"/> </Field-G28PRI_C509_5118> <Field-G28PRI_C509_5375/> <Field-G28PRI_C509_5387/> <Field-G28PRI_C509_5284/> <Field-G28PRI_C509_6411/> </Record-G28PRI> </xsl:when> </xsl:choose> <Record-G29RFF> <Field-G29RFF>G29RFF</Field-G29RFF> <Field-G29RFF_C506_1153>CT</Field-G29RFF_C506_1153> <Field-G29RFF_C506_1154> <xsl:value-of select="CONTRACT"/> </Field-G29RFF_C506_1154> <Field-G29RFF_C506_1156/> </Record-G29RFF> <xsl:if test="normalize-space(PROPOSED_PO_NMBR)!=''"> <Record-G29RFF> <Field-G29RFF>G29RFF</Field-G29RFF> <Field-G29RFF_C506_1153>VN</Field-G29RFF_C506_1153> <Field-G29RFF_C506_1154> <xsl:value-of select="PROPOSED_PO_NMBR"/> </Field-G29RFF_C506_1154> <Field-G29RFF_C506_1156/> </Record-G29RFF> </xsl:if> <xsl:apply-templates select="key('by-line', concat(INST_CODE, '_', PO_NMBR, '_', VENDOR_EAN, '_', PO_LINE, '_', ITEM_UPN, '_', UPN_TYPE))"/> </GroupRecord-Group_5> </xsl:for-each> <Record-CNT> <Field-CNT>CNT</Field-CNT> <Field-CNT_C270_6069_>2</Field-CNT_C270_6069_> <Field-CNT_C270_6066> <xsl:value-of select="sum(/ROWSET/*/SUBLINE_QUANTITY)"/> </Field-CNT_C270_6066> <Field-CNT_C270_6411/> </Record-CNT> </xsl:for-each> </Message-ORDERS> </xsl:template> <xsl:template match="*"> <GroupRecord-Group_7> <Record-G33LOC> <Field-G33LOC>G33LOC</Field-G33LOC> <Field-G33LOC_C517_3225> <xsl:value-of select="LINE_DELIVERY_LOC_EAN"/> </Field-G33LOC_C517_3225> <Field-G33LOC_C517_1131/> <Field-G33LOC_C517_3224/> <Field-G33LOC_3227>7</Field-G33LOC_3227> <Field-G33LOC_C517_3055>9</Field-G33LOC_C517_3055> </Record-G33LOC> <Record-G33QTY> <Field-G33QTY>G33QTY</Field-G33QTY> <Field-G33QTY_C186_6060> <xsl:value-of select="SUBLINE_QUANTITY"/> </Field-G33QTY_C186_6060> <Field-G33QTY_C186_6411/> <Field-G33QTY_C186_6063>11</Field-G33QTY_C186_6063> </Record-G33QTY> <Record-G33DTM> <Field-G33DTM>G33DTM</Field-G33DTM> <Field-G33DTM_C507_2005>2</Field-G33DTM_C507_2005> <Field-G33DTM_C507_2380> <xsl:value-of select="SUBLINE_DELIVERY_DATE"/> </Field-G33DTM_C507_2380> <Field-G33DTM_C507_2379>102</Field-G33DTM_C507_2379> </Record-G33DTM> </GroupRecord-Group_7> </xsl:template> <xsl:template name="loop"> <xsl:param name="freetext"/> <xsl:if test="$freetext != ''"> <Record-G25FTX> <Field-G25FTX>G25FTX</Field-G25FTX> <Field-G25FTX_4451>PUR</Field-G25FTX_4451> <Field-G25FTX_4453/> <Field-G25FTX_C108_4440> <xsl:value-of select="substring($freetext,1,70)"/> </Field-G25FTX_C108_4440> <Field-G25FTX_C108_4440_2> <xsl:value-of select="substring($freetext,71,70)"/> </Field-G25FTX_C108_4440_2> <Field-G25FTX_C108_4440_3> <xsl:value-of select="substring($freetext,141,70)"/> </Field-G25FTX_C108_4440_3> <Field-G25FTX_C108_4440_4> <xsl:value-of select="substring($freetext,211,70)"/> </Field-G25FTX_C108_4440_4> <Field-G25FTX_C108_4440_5> <xsl:value-of select="substring($freetext,281,70)"/> </Field-G25FTX_C108_4440_5> <Field-G25FTX_3453/> </Record-G25FTX> <xsl:call-template name="loop"> <xsl:with-param name="freetext"> <xsl:value-of select="substring($freetext,351)"/> </xsl:with-param> </xsl:call-template> </xsl:if> </xsl:template> </xsl:stylesheet> |
W 3 C h i n a ( since 2003 ) 旗 下 站 点 苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》 |
138.672ms |