ASP / XSL
Here should go questions about transforming XML with XSLT and FOP.
-
- Posts: 1
- Joined: Thu Jul 27, 2006 12:24 pm
ASP / XSL
Post by Danjo_Hart »
I have a master XSL-T sheet I am trying to dynamically update using ASP variables passed to it. I am only getting so far and would like some help.
The xml data looks like:
<?xml version="1.0" encoding="utf-8"?>
<techTree xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<techSkill skillId="AScript" tType="script">
<techIntro/>
<skillName pathActive="No" pathId="/skills/actionscript/actionscript_content.asp">
ActionScript
</skillName>
<skillLevel>
Beginner
</skillLevel>
<firstUsedDate>
2003
</firstUsedDate>
<lastUsed>
Currently
</lastUsed>
<skillYears>
2 years
</skillYears>
<interestLevel>
5
</interestLevel>
</techSkill>
The XSL is here: http://www.jojowebdesign.com/xslt/technology.xsl and at the top you will see:
<xsl:param name="sortBy" select="'skillYears'"/>
<xsl:param name="strXPath" select="//techSkill"/>
-
<xsl:template match="/">
<xsl:value-of select="count(//techSkill)"/>
<xsl:text> Current Technical Skills Returned.</xsl:text>
-
<div style="float: left; padding: 0px 2px; background: #0CF;">
-
<xsl:apply-templates select="$strXPath">
<xsl:sort select="*[name()=$sortBy]" order="descending"/>
</xsl:apply-templates>
</div>
</xsl:template>
My ASP is where I am having trouble passing a variable to the XSL-T. What do I need to do?
:
<%
Dim xslStyleFile, xmlQuery, objNodes
Set xmlDoc = Server.CreateObject("MSXML2.DOMDocument")
Set xslStyleFile = Server.CreateObject("MSXML2.DOMDocument")
xslStyleFile.setProperty "SelectionLanguage", "XPath"
xmlDoc.async = False
xslStyleFile.async = False
xmlDoc.load Server.MapPath("/xmldata/technology.xml")
' Build the XPath query
xmlQuery = "//techSkill/skillName"
objNodes = xmlDoc.selectNodes(xmlQuery)
xslStyleFile.load Server.MapPath("/xslt/technology.xsl")
Response.Write xmlDoc.TransformNode(xslStyleFile)
Set xmlDoc = Nothing
Set xslStyleFile = Nothing
%>
I am crashing at:
objNodes = xmlDoc.selectNodes(xmlQuery)
But I really need more help in prepping the staging area.. Ideas?
The xml data looks like:
<?xml version="1.0" encoding="utf-8"?>
<techTree xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<techSkill skillId="AScript" tType="script">
<techIntro/>
<skillName pathActive="No" pathId="/skills/actionscript/actionscript_content.asp">
ActionScript
</skillName>
<skillLevel>
Beginner
</skillLevel>
<firstUsedDate>
2003
</firstUsedDate>
<lastUsed>
Currently
</lastUsed>
<skillYears>
2 years
</skillYears>
<interestLevel>
5
</interestLevel>
</techSkill>
The XSL is here: http://www.jojowebdesign.com/xslt/technology.xsl and at the top you will see:
<xsl:param name="sortBy" select="'skillYears'"/>
<xsl:param name="strXPath" select="//techSkill"/>
-
<xsl:template match="/">
<xsl:value-of select="count(//techSkill)"/>
<xsl:text> Current Technical Skills Returned.</xsl:text>
-
<div style="float: left; padding: 0px 2px; background: #0CF;">
-
<xsl:apply-templates select="$strXPath">
<xsl:sort select="*[name()=$sortBy]" order="descending"/>
</xsl:apply-templates>
</div>
</xsl:template>
My ASP is where I am having trouble passing a variable to the XSL-T. What do I need to do?
:
<%
Dim xslStyleFile, xmlQuery, objNodes
Set xmlDoc = Server.CreateObject("MSXML2.DOMDocument")
Set xslStyleFile = Server.CreateObject("MSXML2.DOMDocument")
xslStyleFile.setProperty "SelectionLanguage", "XPath"
xmlDoc.async = False
xslStyleFile.async = False
xmlDoc.load Server.MapPath("/xmldata/technology.xml")
' Build the XPath query
xmlQuery = "//techSkill/skillName"
objNodes = xmlDoc.selectNodes(xmlQuery)
xslStyleFile.load Server.MapPath("/xslt/technology.xsl")
Response.Write xmlDoc.TransformNode(xslStyleFile)
Set xmlDoc = Nothing
Set xslStyleFile = Nothing
%>
I am crashing at:
objNodes = xmlDoc.selectNodes(xmlQuery)
But I really need more help in prepping the staging area.. Ideas?
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service