XSL with parameter (in korean)

맡은 일 중에 하나가 XSL에 param을 넣어서 처리하는 것인데, XSL에 대해서 아는 거는, 그냥 XML에 있는 값들을 사이 사이에 집어넣는 거라서 좀 쪽팔렸다. 이미 족은 팔렸고 열심히 공부해서 일을 해내야지. 아자! 열심히 해보자.

Reference

Insturction

  • <xsl:value-of>: <xsl:value-of select=”/greeting” />
  • <xsl:for-each>: for each loop
    • <xsl:for-each select=”/TVGuide/Channel”>
    • </xsl:for-each>

Using and referring to a variable

<xsl:variable name=”minRating” select=”6″ as=”xs:integer” />
Minimum rating: <xsl:value-of select=”$minRating” />

회사에서 쓰고 있는 VB Apps는 MSXML3를 쓰고 있었다. 그러니 MSXML2용으로 parameter를 넘기는 것이 가능하겠지.. ㅎㅎㅎ

VB 예제

Dim xslt As New Msxml2.XSLTemplate30
Dim xslDoc As New Msxml2.FreeThreadedDOMDocument30
Dim xmlDoc As New Msxml2.DOMDocument30
Dim xslProc As IXSLProcessor
xslDoc.async = False
xslDoc.load App.Path & "\createProcessor.xsl"
If (xslDoc.parseError.errorCode <> 0) Then
   Dim myErr
   Set myErr = xslDoc.parseError
   MsgBox("You have error " & myErr.reason)
Else
   Set xslt.stylesheet = xslDoc
   xmlDoc.async = False
   xmlDoc.load App.Path & "\books.xml"
   If (xmlDoc.parseError.errorCode <> 0) Then
      Set myErr = xmlDoc.parseError
      MsgBox("You have error " & myErr.reason)
   Else
      Set xslProc = xslt.createProcessor()
      xslProc.input = xmlDoc
      xslProc.addParameter "param1", "Hello"
      xslProc.Transform
      MsgBox xslProc.output
   End If
End If

<xsl:Choose> 예제

<xsl:param name=”Mode” select=”1″ />
<xsl:param name=”IndustrySectorID” select=”0″ />
<xsl:param name=”SiteID” select=”4″ />

<xsl:output method=”xml” omit-xml-declaration=”no” indent=”yes” encoding=”iso-8859-1″/>
<xsl:strip-space elements=”*”/>
<xsl:template match=”/”>
<xsl:choose>
<xsl:when test = “$Mode = 1″><xsl:apply-templates select=”/” mode=”Map1″ /></xsl:when>
<xsl:when test = “$Mode = 2″><xsl:apply-templates select=”/” mode=”Map2″ /></xsl:when>
<xsl:when test = “$Mode = 4″><xsl:apply-templates select=”/” mode=”Map4″ /></xsl:when>
<xsl:when test = “$Mode = 5″><xsl:apply-templates select=”/” mode=”Map5″ /></xsl:when>
</xsl:choose>
</xsl:template>

XSL with parameter (in korean)

One thought on “XSL with parameter (in korean)

  1. It’s always been the scenario that women tend to have more shoes than men because women have always been crazy for shoes. They love everything about it; design, styles, comfort and shoes definitely play a great role in completing your attire and endow you with a stylish and cool look depending on your choice of shoes. Womens fashion shoes are now something more than just a protection for your feet; their classy and extraordinary designs have placed them on top of the most designer wear that an individual can carry.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s