顯示具有 XSLT 標籤的文章。 顯示所有文章
顯示具有 XSLT 標籤的文章。 顯示所有文章

XSLT轉換範例程式


System.Xml.Xsl.XslCompiledTransform xslCompiledTransform = new System.Xml.Xsl.XslCompiledTransform();
xslCompiledTransform.Load("http://localhost/Letter/Letter.xslt");
System.Xml.XmlReaderSettings pXmlReaderSetttings = new System.Xml.XmlReaderSettings();
pXmlReaderSetttings.IgnoreWhitespace = true;
pXmlReaderSetttings.XmlResolver = null;
pXmlReaderSetttings.ProhibitDtd = false;
StringBuilder pStringBuilder = new StringBuilder();
System.Xml.XmlWriter pXmlWriter = System.Xml.XmlWriter.Create(pStringBuilder);
pXmlWriter.WriteProcessingInstruction("xml", "version=\"1.0\" encoding=\"UTF-8\"\n");
xslCompiledTransform.Transform(node.OwnerDocument.CreateNavigator(), pXmlWriter);
pXmlWriter.Close();
string xmlResult = pStringBuilder.ToString();
System.Xml.XmlDocument XAML = new System.Xml.XmlDocument();
XAML.LoadXml(xmlResult);
return XAML.FirstChild;

xslt轉換-於xslt:for-each中加入流水號


<xsl:for-each select="/函/聯絡方式">
<TextBox Width="260" Height="Auto" BorderThickness="0,0,0,0"
TextAlignment="Left" TextWrapping="Wrap" FontFamily="DFKai-SB"
Background="{x:Null}" BorderBrush="{x:Null}">
<xsl:attribute name="Text">
<xsl:value-of select="." />
</xsl:attribute>
<xsl:attribute name="x:Name">
LET_COMMUNICATOR_DETAIL_ <xsl:number value="position()" format="1" />
</xsl:attribute>
</TextBox>
</xsl:for-each>

橫式廣告