xslt problem


I am trying to develop an xslt engine.  However, when I put the raw xml file into the engine, the output is the original/complete xml file.  I was trying to only extract certain data from the original xml file.  The code is below

<xsl:stylesheet version="2.0" 
	exclude-result-prefixes="xs xdt err fn">

	<xsl:output method="xml" indent="yes"/>
	<xsl:template match="/">
<xsl:value-of select="invention-title"></xsl:value-of>
<xsl:value-of select="abstract"></xsl:value-of>

<xsl:value-of select="us-parties/us-applicants/us-applicant"></xsl:value-of>
<xsl:value-of select="us-parties/inventors/inventor"></xsl:value-of>
<xsl:value-of select="us-exemplary-claim"></xsl:value-of>

<xsl:value-of select="us-bibliographic-data-grant/application-reference"></xsl:value-of>
<xsl:value-of select="us-term-of-grant/us-term-of-extension"></xsl:value-of>
<xsl:value-of select="classifications-ipcr/classification-ipcr/section"></xsl:value-of>
<xsl:value-of select="classifications-ipcr/classification-ipcr/class"></xsl:value-of>
<xsl:value-of select="classifications-ipcr/classification-ipcr/subclass"></xsl:value-of>
<xsl:value-of select="classifications-ipcr/classification-ipcr/main-group"></xsl:value-of>
<xsl:value-of select="classifications-ipcr/classification-ipcr/subgroup"></xsl:value-of>
<xsl:value-of select="classification-national/main-classification"></xsl:value-of>

<xsl:value-of select="classification-national/further-classification"></xsl:value-of>

<xsl:value-of select="us-field-of-classification-search/classification-national/main-classification"></xsl:value-of>
<xsl:value-of select="drawings/figure"></xsl:value-of>



Open in new window

Do you have any solution, or is there a problem with my code?  Thank you.  Robert
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Geert BormansInformation ArchitectCommented:
Hi Robert,

I have some observations:

- your ouput method is XML but nowhere in the stylesheet you output tags, just values. Since you are not outputting no root element, the result can't be XML, so your system could choque on that

- you use XSLT2... are you sure you are using an XSLT 2.0 processor?

- This XSLT has a template for "/". Unless you launch the process with an initial-template, you will end up there. So you must be using a different stylesheet then this one, otherwise you can't simply reproduce what you have got

Bottom line. If there is an error, it is in how you call the XSLT, not in the XSLT itself.
We need more detail please


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
RobertGeoffAuthor Commented:
Thank you for your comments.  While they did not help exactly, because you did not have compete information, I was motivated to go back and re-write the code and now it works well.  Instead of focusing on the values, I focused on copy and for-each.  Robert
Geert BormansInformation ArchitectCommented:
OK great
JavaScript Best Practices

Save hours in development time and avoid common mistakes by learning the best practices to use for JavaScript.

RobertGeoffAuthor Commented:

As you're an xslt expert, you can help me out with one other thing.  Let me know if I need to formerly post.

I'll incorpoate my xslt engine into a vb(2010) application.  The xslt engine will be located at a specific url.  this will allow me to distibute the application only.

do you have any sample code handy?  i'll start to code later today, but having a good reference is useful.  robert
Geert BormansInformation ArchitectCommented:
Hi Robert,

There are some things you need to be aware of.

VB.net does not natvely support XSLT2
so this
<xsl:stylesheet version="2.0"
should be
<xsl:stylesheet version="1.0"
and there are a bunch of functions you then can not use
(likely you don't use them)

I am not a VB.net coder, so basicaly I have no clue how to call an XSLT from a VB.net application
but I usually look around...
maybe this would help
RobertGeoffAuthor Commented:
Thanks.  That little bit about "1.0" and "2.0" was a big time saver.  RD
Geert BormansInformation ArchitectCommented:
RobertGeoffAuthor Commented:

FYI, My final code is below.  You may find it useful in the future.  But, I am trouble accessing the XSL from an online server.  I have tried putting in DROPLR, but I keep getting an error message.  Right now, I stuck it on Google, but I'm not sure if this will work.  Do you know of a suitable way to store an XSL file on an online server for access by an application?  Thanks.  Robert

Public Class XSLTform

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim document As XmlDocument
        Dim savefileDialog1 As New SaveFileDialog()
        Dim output As StringWriter
        Dim navigator As XPathNavigator

        document = New XmlDocument()

        'load the stylesheet
        Dim xslt As New XslCompiledTransform()
        xslt.Load("C:\Users\RobertGeoff\Pictures\Patent Pie docs and programs\PatentXSLT.xsl")

        'execute the transformation and output results to a file
        xslt.Transform(textbox1.Text, "Save.Text")

        output = New StringWriter()
        navigator = document.CreateNavigator
        xslt.Transform(navigator, Nothing, output)

        Dim stream As FileStream = _
        New FileStream(savetxt.Text, FileMode.Create)

        Dim writer As StreamWriter = New StreamWriter(stream)

        ' close streams

        'upon pressing the transformation button, a dialog to save the file should come up- Cf the savefiledialog sub down below.
        savefileDialog1.Title = "Select or Enter Filename"
        savefileDialog1.Filter = "xml Files(*.xml)|*.xml|All Files|*,*"
        savefileDialog1.FilterIndex = 1
        savefileDialog1.RestoreDirectory = True

    End Sub

Open in new window

Geert BormansInformation ArchitectCommented:
it all depends on the .net mechanism of resolving the url in the load
it might be that you need to deactivate some security settings
I am afraid this really is a VB.net issue and I recommend that you post a question in the VB.net TA
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.