Line breaks in XML

Status
Niet open voor verdere reacties.

pvdberg87

Gebruiker
Lid geworden
26 apr 2011
Berichten
10
Hallo iedereen,

Ik heb een XML file die ik laat opbouwen door een php script.
Werkt allemaal prima. De gaat over een xlst en dan wordt er een *.docx document van gemaakt. Hiervoor heb ik deze tutorial gebruikt.
http://msdn.microsoft.com/en-us/library/ee840137(v=office.12).aspx

Dit gaat allemaal goed als ik tekst gebruikt zonder line breaks (enters)

Een node van de XML kan ook als volgt zijn:
Code:
<DiscriptionSubRequirement>When presented with a double medication message, the user has the following options:
- Cancel the medication order
- Proceed with the medication order. The user has to provide a rationale in this case.
</DiscriptionSubRequirement>

Er zitten line breaks in de <discriptionSubRequirement> node.
Echter als er naar word ge-exporteerd wordt, dan wordt alle tekst achter elkaar gezet.

Mijn XLST ziet er als volgt uit:
Code:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
	<xsl:template match="/">
			<w:document xmlns:wpc="http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:wp14="http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml" xmlns:wpg="http://schemas.microsoft.com/office/word/2010/wordprocessingGroup" xmlns:wpi="http://schemas.microsoft.com/office/word/2010/wordprocessingInk" xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml" xmlns:wps="http://schemas.microsoft.com/office/word/2010/wordprocessingShape" mc:Ignorable="w14 wp14">
			<w:body>
				<w:p w:rsidR="00490272" w:rsidRPr="001C3AA2" w:rsidRDefault="00490272" w:rsidP="00490272">
					<w:pPr><w:pStyle w:val="Kop1"/>
					</w:pPr>
					<w:bookmarkStart w:id="0" w:name="_Toc310946733"/><w:r w:rsidRPr="001C3AA2">
						<w:t>Specific Requirements</w:t></w:r><w:bookmarkEnd w:id="0"/>
				</w:p>
				<w:p w:rsidR="00490272" w:rsidRPr="00AB180B" w:rsidRDefault="001C3AA2" w:rsidP="00490272">
					<w:pPr>
						<w:pStyle w:val="Plattetekst"/>
						<w:rPr>
							<w:i/>
						</w:rPr>
					</w:pPr>
					<w:r w:rsidRPr="00AB180B">
						<w:rPr>
							<w:i/>
						</w:rPr>
						<w:t>Specify the software requirements. Each requirement has a unique id, a unique title and a description.</w:t>
					</w:r>
					<w:r w:rsidR="00AB180B" w:rsidRPr="00AB180B">
						<w:rPr>
						<w:i/>
						</w:rPr>
						<w:t xml:space="preserve"> The paragraphs are provided as guidance, unused paragraphs can be removed.</w:t>
					</w:r>
				</w:p>
				<!-- for-each loop added for ParenRequirements-->
				<xsl:for-each select="SoftwareRequirements/ParentRequirement">
				<w:p w:rsidR="00CF60A1" w:rsidRDefault="00E766E5" w:rsidP="00D80CC9"><w:pPr><w:pStyle w:val="Kop2"/>
				</w:pPr>
					<w:r>
						<w:t>
							<xsl:value-of select="@name"/>
						</w:t>
					</w:r>
				</w:p>
				<!-- for-each loop added for requirements -->
					<xsl:for-each select="requirements">
						<w:p w:rsidR="00113E46" w:rsidRPr="006B002F" w:rsidRDefault="00E766E5" w:rsidP="00113E46">
							<w:pPr>
								<w:pStyle w:val="Requirement"/>
							</w:pPr>
							<w:r>
								<w:t>
									<!-- Get Title from subrequirement -->
									<xsl:value-of select="TitleSubRequirement"/>
								</w:t>
							</w:r>
						</w:p>
						<w:p w:rsidR="00113E46" w:rsidRDefault="00E766E5" w:rsidP="00113E46">
							<w:pPr>
								<w:pStyle w:val="Plattetekst"/>
							</w:pPr>
							<w:r>
								<w:t>
									<!--<xsl:value-of select="
"/>-->
									<!-- Get Discription from subrequirement -->
									<xsl:value-of select="DiscriptionSubRequirement"/>
								</w:t>
							</w:r>
						</w:p>
						<!-- Een extra enter na iedere suftwarerequirement
						<w:p w:rsidR="00E766E5" w:rsidRDefault="00E766E5" w:rsidP="00113E46">
							<w:pPr>
								<w:pStyle w:val="Plattetekst"/>
							</w:pPr>
						</w:p> -->
						<w:p w:rsidR="0019000B" w:rsidRDefault="0019000B" w:rsidP="00113E46">
							<w:pPr>
								<w:pStyle w:val="Plattetekst"/>
							</w:pPr>
							<w:bookmarkStart w:id="1" w:name="_GoBack"/>
							<w:bookmarkEnd w:id="1"/>
						</w:p>
					</xsl:for-each>
				</xsl:for-each>
				<w:sectPr w:rsidR="0019000B" w:rsidSect="00E766E5">
					<w:headerReference w:type="default" r:id="rId9"/>
					<w:footerReference w:type="first" r:id="rId10"/>
					<w:type w:val="continuous"/>
					<w:pgSz w:w="11907" w:h="16840" w:code="9"/>
					<w:pgMar w:top="2160" w:right="1152" w:bottom="1152" w:left="1440" w:header="706" w:footer="360" w:gutter="0"/>
					<w:cols w:space="708"/>
					<w:docGrid w:linePitch="299"/>
				</w:sectPr>
			</w:body>
		</w:document>
	</xsl:template>
</xsl:stylesheet>

Iemand enig idee hoe ik ervoor kan zorgen zodat de line breaks ook in Word meegenomen worden.
 
Status
Niet open voor verdere reacties.
Terug
Bovenaan Onderaan